passport-next / passport-openid

OpenID authentication strategy for Passport and Node.js.
MIT License
6 stars 3 forks source link

Allow the return URL to vary per connection. #4

Closed hodgman closed 3 years ago

hodgman commented 3 years ago

Allows the returnURL and realm properties to be a string (old behavior) or a function (new behavior).

Previously you could only use a string, such as: returnURL: 'http://localhost:3000/auth/openid/return'

With this change, you can also use a function that takes the request as a parameter, such as: returnURL: req => 'http://localhost:3000/auth/openid/return' + querystring.stringify(req.query)

This provides a simple way to preserve some request information through the login process, without the need for sessions/cookies/etc.

hodgman commented 3 years ago

Hahahah, oh I'm so sorry. I just realized there's already a PR for this exact same improvement!