Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TokenError: Code was already redeemed. Only when using routes with url parameters. #113

Open
keithminder opened this issue Feb 6, 2016 · 0 comments

Comments

@keithminder
Copy link

The following code (with url parameter "redirect") causes the issue:
'use strict';

import express from 'express';
import passport from 'passport';
import {setTokenCookie} from '../auth.service';

var router = express.Router();

router
.get('/:redirect', passport.authenticate('google', {
failureRedirect: '/signup',
scope: [
'profile',
'email'
],
session: false
}))
.get('/callback', passport.authenticate('google', {
failureRedirect: '/signup',
session: false
}), setTokenCookie);

export default router;

The issue is not encountered with the following code:
'use strict';

import express from 'express';
import passport from 'passport';
import {setTokenCookie} from '../auth.service';

var router = express.Router();

router
.get('/redirect', passport.authenticate('google', {
failureRedirect: '/signup',
scope: [
'profile',
'email'
],
session: false
}))
.get('/callback', passport.authenticate('google', {
failureRedirect: '/signup',
session: false
}), setTokenCookie);

export default router;

I have tested and re-tested numerous times and have isolated this issue to only occur with routes with parameters.

I worked around this issue by using query string parameters instead of url parameters. This is not a duplicate of other TokenError related issues, btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant