# gateway-social-auth

A NodeJS + Express application to handle the social authentication of Artists(a.k.a Participants) in the OrchardGo mobile app.

## Install Dependencies

It is assumed you have installed the following:

-   [Node](https://nodejs.org/en/download/)
-   [Yarn](https://classic.yarnpkg.com/en/docs/install)

**NOTE:**

-   **Running the project locally requires an active VPN connection.**
-   **Ensure you have orchard yarn package access, if not run [the curl command here](https://github.com/theorchard/frontend-cli/blob/master/docs/usage.md):**

## Create a environment file

Copy the existing environment file and fill out the environment details obtained from the tech team at The Orchard.

```sh
cp .env.shadow .env
```

## Generating Certificates for running a secure server

Some social platforms require https for their redirect uri.
This is not a problem in production but in dev mode in order to run an https server we need to
generate self signed certificates. Paste the following code in your terminal for further authentication.

```sh
openssl genrsa -out key.pem
openssl req -new -key key.pem -out csr.pem
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
rm csr.pem
```

## Running Locally

```sh
$ git clone git@github.com:theorchard/gateway-social-auth.git
$ yarn install
$ yarn build
$ yarn start
```

## Running tests

Tests are written using Jest.

```sh
$ yarn test
```

## Running in watch mode

```sh
$ yarn watch
```

## Running in debug mode

```sh
$ yarn debug
```

## Cleaning all the files

Removes all build files from dist/, coverage files from coverage/ and node modules node_modules/

```sh
$ yarn clean
```

## Current social authentication platforms integrated

-   [x] Instagram -- ongoing
-   [ ] Twitter
-   [ ] Facebook
-   [ ] Soundcloud
