These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

passport-eveonline

Author
Ogeko Ronuken
Pator Tech School
Minmatar Republic
#1 - 2016-05-08 07:49:14 UTC
i was wondering if anyone have used this and got it working?

TokenError: Unknown client

https://github.com/mbrennan/passport-eveonline



Thanks
Tukao
Viziam
Amarr Empire
#2 - 2016-05-08 14:57:48 UTC
I'm currently using it with express and express-session with no issues doing something like this:

sso.js

var express = require('express');
var passport = require('passport');
var PassportEveOnline = require('passport-eveonline');

var router = express.Router();

passport.use(new PassportEveOnline({
  "clientID": "x",
  "clientSecret": "x",
  "callbackURL": "http://localhost:3000/sso/cb"
}, function (characterInformation, done) {
  return done(null, characterInformation);
}));

passport.serializeUser(function (user, done) {
  done(null, user);
});

passport.deserializeUser(function (user, done) {
  done(null, user);
});

router.get('/sso', passport.authenticate('eveonline'));
router.get('/sso/cb', passport.authenticate('eveonline', {
  successRedirect: '/',
  failureRedirect: '/sso/fail'
}));

module.exports = router;



App.js

var express = require('express');
var session = require('express-session');
var passport = require('passport');

var  sso = require('./sso.js');

var app = express();

app.use(session({
  secret: 'blablabla',
  resave: true,
  saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(sso);

app.get('/charName', function(req, res, next) {
  res.status(200).send(req.session.passport.user.CharacterName);
  return next();
});


hitting /sso will take you through authentication. You should then be able to get the character name from /charName.

Hope it helps.
Ogeko Ronuken
Pator Tech School
Minmatar Republic
#3 - 2016-05-09 04:34:12 UTC
Thanks for the infomation