Skip to content

Make auth callback URL relative to base API_URL#6938

Closed
jake-low wants to merge 1 commit intohotosm:developfrom
jake-low:auth-callback-relative-url
Closed

Make auth callback URL relative to base API_URL#6938
jake-low wants to merge 1 commit intohotosm:developfrom
jake-low:auth-callback-relative-url

Conversation

@jake-low
Copy link
Copy Markdown
Contributor

@jake-low jake-low commented Jul 8, 2025

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation
  • 🧑‍💻 Refactor
  • ✅ Test
  • 🤖 Build or CI
  • ❓ Other (please specify)

Describe this PR

This is a tweak to the changes made in #6933. That PR works correctly AFAIK for tasks.hotosm.org's use case, but I discovered when backporting the fix to osmus/tasking-manager (which powers tasks.openstreetmap.us and tasks.teachosm.org) that it does not work if the backend is deployed to a nonstandard URL path.

This change makes the callback URL string a relative path (removing the hardcoded /api/v2 prefix). The appropriate prefix will then be prepended in fetchLocalJSONAPI() when the string is converted to a URL object. This prefix may be /api/v2 or it may be another value depending on the configuration environment variables provided at runtime.

This change is running in production on tasks.openstreetmap.us and tasks.teachosm.org already, so I am fairly confident that it works.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jul 8, 2025

@ramyaragupathy
Copy link
Copy Markdown
Member

@suzit-10 can you please review this PR?

@suzit-10
Copy link
Copy Markdown
Contributor

suzit-10 commented Sep 4, 2025

Thank you @jake-low for raising this 🙏
Removing the hardcoded /api/v2 is definitely a good improvement, and it’s very helpful for instances with non-standard backend URL (e.g., without /api/v2).
Besides the authorization URL, there are a few other places with the same prefix — could you update those too? I think it will also need a small tweak to fetchLocalJSONAPI(), since it’s used across the codebase, and simply prepending may not work in all cases (e.g., where api/v2 isn’t expected).

Really appreciate you taking the time to look into this 🙌

@jake-low
Copy link
Copy Markdown
Contributor Author

Hi @suzit-10, thanks for reviewing this. I unfortunately don't have time to revisit this PR and modify or retest it. I believe it fixes a genuine bug, although it may not fix all occurrences of that bug since I was focused only on fixing the code introduced in #6933.

Feel free to either merge this PR or close it at your discretion.

@suzit-10
Copy link
Copy Markdown
Contributor

suzit-10 commented Sep 18, 2025

Hi @jake-low, thanks for the update! I appreciate you taking the time to address this. I'll proceed with the required changes across the code and merge the PR.

ramyaragupathy added a commit that referenced this pull request Jan 2, 2026
Remove hardcoded `/api/v2/` prefixes from backend URLs (follow-up to #6938)
@ramyaragupathy ramyaragupathy mentioned this pull request Jan 15, 2026
7 tasks
@jake-low
Copy link
Copy Markdown
Contributor Author

This was superseded by #7046 which has been merged and released, so I'll close this one.

@jake-low jake-low closed this Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants