-
Notifications
You must be signed in to change notification settings - Fork 9
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
adding state within passport authenticate causes a failure #6
Comments
Hi @VinHylme, I am behind a schedule so I will check this on Monday. |
@jnv no probs, thanks :) |
@VinHylme Thanks for your patience. So passing the state like this should absolutely work, it's actually implemented by the backing The gist is:
With these options checked, you can then get back your state from app.get(
'/auth/twitter/callback',
passport.authenticate('twitter', {
failureRedirect: '/error?login'
}),
(req, res, next) => {
console.log('The state is:', req.authInfo.state);
next();
}
); Mind that this isn't a feature of this library, all of this is handled just by the I am removing the bug label but keep this issue open to add this info into our README. Let me know if it works for you! |
This was helpful but in my case req.authInfo was undefined always so had to extract it from the session instead.
|
Hey I am having same issue, it is not working when I am adding custom state like this I am getting Twitter OAuth2 strategy within Passport
|
Hi, thanks for your comment. Just a quick guess. Have you tried passing state as an object? |
You might also find this blog post by Jared helpful. |
Hey, this is working but I can access the state object on my backend when I am making call to the callback URL, then I can send it on client side, but is it possible to access the state object in the call back URL as a params? |
I'm facing this, any fixes? |
Hey there, I have returned once more,
I am trying to pass additional parameters via my query to the callback function however when I try adding the state
const authenticator = passport.authenticate('twitter', { scope: ['tweet.read', 'users.read', 'follows.read'], state});
authenticator(req, res, next);
the whole auth fails, any idea how I can resolve this?
Note: i know that twitter uses it's own state param, is there way i can add mine on top of it or add a different one
The text was updated successfully, but these errors were encountered: