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
Problem:
When you develop a real project like web-server, you have multiple versions of it:
development (it can be localhost),
stage/testing server,
production server
These servers have their own URLs and they can be changed in the future. According to documentation, you should pass URL in redirect_uris, but you can't specify it in code. You can do it with using environment variables:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Problem:
When you develop a real project like web-server, you have multiple versions of it:
These servers have their own URLs and they can be changed in the future. According to documentation, you should pass URL in
redirect_uris
, but you can't specify it in code. You can do it with using environment variables:but in this case, you should change this variable every time when you want to change the URL. If you forget, an error will occur.
My suggestion:
Use relative URL in configuration:
and resolve it in Strategy, before calling the authentication request, like this:
https://github.com/jaredhanson/passport-oauth2/blob/v1.5.0/lib/strategy.js#L145-L147
Beta Was this translation helpful? Give feedback.
All reactions