Update index.js
This commit is contained in:
parent
4a905bdcfc
commit
47da4c6855
@ -2,14 +2,19 @@ var app = require('express')();
|
|||||||
var http = require('http').Server(app);
|
var http = require('http').Server(app);
|
||||||
var io = require('socket.io')(http);
|
var io = require('socket.io')(http);
|
||||||
var socketioJwt = require('socketio-jwt');
|
var socketioJwt = require('socketio-jwt');
|
||||||
|
var auth0Variables = require('./auth0-variables');
|
||||||
|
|
||||||
app.get('/', function(req, res){
|
app.get('/', function(req, res){
|
||||||
res.sendFile(__dirname + '/index.html');
|
res.sendFile(__dirname + '/index.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/auth0-variables.js', function(req, res){
|
||||||
|
res.sendFile(__dirname + '/auth0-variables.js');
|
||||||
|
});
|
||||||
|
|
||||||
io
|
io
|
||||||
.on('connection', socketioJwt.authorize({
|
.on('connection', socketioJwt.authorize({
|
||||||
secret: Buffer('YOUR_CLIENT_SECRET', 'base64'),
|
secret: Buffer(auth0Variables.AUTH0_CLIENT_SECRET, 'base64'),
|
||||||
timeout: 15000 // 15 seconds to send the authentication message
|
timeout: 15000 // 15 seconds to send the authentication message
|
||||||
}))
|
}))
|
||||||
.on('authenticated', function(socket){
|
.on('authenticated', function(socket){
|
||||||
|
Reference in New Issue
Block a user