2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00
socketio-jwt/example/socketsio-auth0-sample
Jason Haines 3c30d30368 'unauthorized' event handler
The example doesn't give any notification on an Unauthorised error.
It would be nice to log something on the server too, but I don't see how to do this.
2016-04-16 17:00:05 +10:00
..
public/stylesheets Update style.css 2015-12-01 16:48:31 -04:30
views 'unauthorized' event handler 2016-04-16 17:00:05 +10:00
index.js Update index.js 2015-12-01 15:33:06 -04:30
package.json Changed popup to redirect mode, updated dependencies 2016-01-07 16:44:05 +02:00
README.md Update README.md 2015-12-01 15:45:49 -04:30

Auth0 + Socket.io

This is the seed project you need to use if you're going to create a Socket.io single page app that will use Auth0.

Configure your Auth0 credentials

First, you need to set the ClientSecret, ClientId and Domain for your Auth0 app as environment variables with the following names respectively: AUTH0_CLIENT_SECRET, AUTH0_CLIENT_ID and AUTH0_DOMAIN. You can find this information in your Auth0 Dashboard.

So, create a file named .env in the directory and set the values like the following:

# .env file
AUTH0_CLIENT_SECRET=myCoolSecret
AUTH0_CLIENT_ID=myCoolClientId
AUTH0_DOMAIN=myCoolDomain

Set up the Allowed Origin (CORS) in Auth0

Then, you need to put http://localhost:3001 as an Allowed Origin (CORS) in the Application Settings on your Auth0.com dashboard.

Running the example

In order to run the example, you need to have node installed.

  1. run npm install
  2. run node index.js in the directory of this project.

Go to http://localhost:3001 and you'll see the app running :).