Respect client-requested redirect_uri in OAuth flow#1248
Merged
Conversation
The OAuth redirect_uri was hardcoded to config.getMRFrontend in both the authorize request and the token exchange, so a login started on any frontend (e.g. beta.maproulette.org) sharing this backend would be redirected to the backend's single configured frontend after authenticating with OSM. Both /auth/authenticate and /auth/callback now accept a redirectUri parameter and fall back to the request's Origin header, then the configured frontend. OSM validates redirect_uri against the OAuth app's registered URIs, so no local allowlist is needed.
jake-low
approved these changes
Jun 29, 2026
jake-low
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks for implementing this!
This has an additional benefit which isn't mentioned in the PR description: with this change, it'll be possible to use OAuth login when running the frontend locally (i.e. during development) while it's configured to talk to the production backend. Currently this is possible only by setting REACT_APP_SERVER_API_KEY (in maproulette3) or VITE_SERVER_API_KEY (in maproulette4) to your user account's API key before starting the frontend.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The OAuth redirect_uri was hardcoded to config.getMRFrontend in both the authorize request and the token exchange, so a login started on any frontend (e.g. beta.maproulette.org) sharing this backend would be redirected to the backend's single configured frontend after authenticating with OSM.
Both /auth/authenticate and /auth/callback now accept a redirectUri parameter and fall back to the request's Origin header, then the configured frontend. OSM validates redirect_uri against the OAuth app's registered URIs, so no local allowlist is needed.