passport-oauth2
passport-oauth2 copied to clipboard
Dynamic redirect_uri from queryString ?
It is common that login page with a param url=xxx
, will jump to url
after login successfully.
Now callbackURL is static, could only be configured as a unique value.
Maybe it's better if it can have some dynamic param from url query string.
It would be nice to have a setter for the callbackURL
, much like it has been done here:
https://github.com/jaredhanson/passport-oauth/issues/2
it's easy enough to subclass, here is a currently working solution:
class MyStrategy extends OauthStrategy {
authenticate(req: Request, options) {
// tslint:disable-next-line:no-string-literal
const callbackURL = options.callbackURL || this['_callbackURL']
options.callbackURL = addReturnTo(req, callbackURL)
return super.authenticate(req, options)
}
}