Skip to content

Commit

Permalink
Readme and .env.example
Browse files Browse the repository at this point in the history
  • Loading branch information
sbauch committed Feb 22, 2021
1 parent af70934 commit faf067c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
14 changes: 3 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
REACT_APP_WEBSITE_PORT=
REACT_APP_API_URL=

# Github
REACT_APP_GITHUB_CLIENT_ID=
REACT_APP_GITHUB_CLIENT_SECRET=

# Google
REACT_APP_GOOGLE_CLIENT_ID=
REACT_APP_GOOGLE_CLIENT_SECRET=

# Facebook
REACT_APP_FACEBOOK_CLIENT_ID=
REACT_APP_FACEBOOK_CLIENT_SECRET=
OSSO_BASE_URL=https://demo.ossoapp.com
OSSO_CLIENT_ID=demo-client-id
OSSO_CLIENT_SECRET=demo-client-secret
47 changes: 27 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<table>
<tr>
<td><img width="100px" src="https://raw.githubusercontent.com/enterprise-oss/osso/main/.github/logo.png" /></td>
<td>+</td>
<td><img width="200px" src="https://raw.githubusercontent.com/supertokens/supertokens-logo/master/images/Artboard%20%E2%80%93%2027%402x.png" /></td>
</tr>
</table>

![SuperTokens banner](https://raw.githubusercontent.com/supertokens/supertokens-logo/master/images/Artboard%20%E2%80%93%2027%402x.png)
# Osso + SuperTokens Demo app

# SuperTokens Demo app
This demo app shows how to integrate Osso in a Node and React app that uses SuperTokens for user authentication.

This demo app demonstrates the following use cases:
- Social Login / Sign up
- Logout
- Session management & Calling APIs
You'll need an Osso instance which you can [self-host](https://ossoapp.com/docs/deploy/overview) or [purchase as a SaaS subscription](https://ossoapp.com/pricing). You can also utilize Osso's Demo Instance for testing - `.env.example` includes variables for working with the Osso demo instance.

You'll also need a SuperTokens instance, which you can also self-host or purchase a SaaS subscription. If you've found this project we assume you are already familiar with SuperTokens.

## Project setup

Expand All @@ -16,21 +22,15 @@ Use `npm` to install the project dependencies:
npm install
```

# Providers credentials
# Osso credentials

Copy the `.env.example` file and add your credentials:
Copy the `.env.example` file. If you are using your own Osso instance, replace the relevant variables with the information for your instance and OAuth client.

```bash
cp .env.example .env
```

Please refer to the corresponding documentations to get your client ids and client secrets for each of the providers you want to integrate with:<br/>
- <a href="https://developers.google.com/identity/sign-in/web/sign-in#create_authorization_credentials" rel="noopener noreferrer" target="_blank" >Google</a><br/>
- <a href="https://docs.github.com/en/developers/apps/creating-an-oauth-app" rel="noopener noreferrer" target="_blank" >Github</a><br/>
- <a href="https://developers.facebook.com/docs/development/create-an-app" rel="noopener noreferrer" target="_blank" >Facebook</a><br/>
</div>

Set redirect URI to http://localhost:3000/auth/callback/{providerId} in each developer panels (make sure to replace `providerId` with `google | facebook | github`).
In your Osso instance, add an allowed redirect URI for each of your OAuth clients with the path `/auth/callback/osso`. For instance, if you are running this application locally, add `http://localhost:3000/auth/callback/osso` to your Development OAuth Client.

## Run the demo app

Expand All @@ -39,16 +39,18 @@ This compiles and serves the React app and starts the backend API server on port
```bash
npm run dev
```

The app will start on `http://localhost:3000`

## Project structure & Parameters

- The frontend code is located in the `src` folder.
- The backend API is in the `api-server.js` file.
- You can provide the following params to the `npm run` commands:
- `REACT_APP_API_PORT`: To change the port for the API. The default is `3001`
- `REACT_APP_API_URL`: In case the API is not hosted on `localhost`. This must contain the port as well.
- `REACT_APP_WEBSITE_PORT`: To change the port of the website server. The default is `3000`
- `REACT_APP_WEBSITE_URL`: In case the website is not hosted on `localhost`. This must contain the port as well.
- `REACT_APP_API_PORT`: To change the port for the API. The default is `3001`
- `REACT_APP_API_URL`: In case the API is not hosted on `localhost`. This must contain the port as well.
- `REACT_APP_WEBSITE_PORT`: To change the port of the website server. The default is `3000`
- `REACT_APP_WEBSITE_URL`: In case the website is not hosted on `localhost`. This must contain the port as well.


## Deployment
Expand All @@ -59,14 +61,19 @@ The app will start on `http://localhost:3000`
npm run build
```

### Live demo

A live demo is available at <https://supertokens-example.ossoapp.com>.

### Running in production

```bash
npm run prod
```

## Author

Created with :heart: by the folks at SuperTokens.io.
Created with :heart: by the folks at SuperTokens.io, forked and updated by the folks at Ossoapp.com

## License

Expand Down

0 comments on commit faf067c

Please sign in to comment.