You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this awesome library. I am using it in Production, and I have a doubt about what to do when I can't authenticate the user with a given token.
Right now I'm calling done(null, error) but that return the error and render it in the web, and that's not what I want. I want to be able, for example, to clean the user cookie and redirect him to the home page.
How can I do that? Can I have access to the req, res objects inside the Strategy configuration?
passport.use(
new RememberMeStrategy(
(token, done) => {
loginWithHash(token).then(response => {
if (!response.success) {
// HERE: instead of doing that, I want to clean the user cookies and redirect to home
return done(response.error);
}
return done(null, response.data);
});
},
(user, done) => done(null, user.hash),
),
);
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Hi,
Thanks for this awesome library. I am using it in Production, and I have a doubt about what to do when I can't authenticate the user with a given token.
Right now I'm calling done(null, error) but that return the error and render it in the web, and that's not what I want. I want to be able, for example, to clean the user cookie and redirect him to the home page.
How can I do that? Can I have access to the req, res objects inside the Strategy configuration?
Thanks in advance.
The text was updated successfully, but these errors were encountered: