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
Optionally pass accessToken as a parameter to returnTo #102
Comments
when you configure the passport provider you set the success url, set that as a middleware in the backend like "successRedirect": "/auth/account" then just create a middleware like app.get('/auth/account', function (req, res, next) {
app.models.Account.findById(req.accessToken.userId, function(err, account) {
if (err) { next(err); }
res.redirect('http://yourdomain.com?accessToken=' + req.accessToken.id + '&userId=' + account.id);
});
}); |
Thanks @jonathan-casarrubias this is a good suggestion. This looks like a good option for SPA login. I am using it as below in my react client app,
at
Is it possible to create a middleware in the failure case also? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the |
On mobile devices, it is useful to have the login redirect to a URL with a custom protocol (myapp://) so that the intent can be captured and the login processed. In 1.6.0 we have the ability to set a returnTo session key for the successRedirect.
It would be extremely useful to be able to append the accessToken generated from a successful login to this URL as query parameters, as they can be read by a mobile application.
The text was updated successfully, but these errors were encountered: