Fix redirectUri for roblox oauth#175
Conversation
📝 WalkthroughWalkthroughThe Roblox OAuth start handler now points authorization redirects to ChangesRoblox OAuth flow
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pages/api/auth/roblox/start.ts`:
- Line 18: Update the redirect URI assignment in the Roblox start handler to use
the same resolver and precedence as the callback handler, including
ROBLOX_REDIRECT_URI and instanceConfig.robloxRedirectUri overrides before base
URL fallbacks. Ensure authorization and token exchange send the identical
callback URI, preferably by reusing the callback’s shared resolver.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 403fa597-ae24-4910-b8e3-2897913e9584
📒 Files selected for processing (1)
pages/api/auth/roblox/start.ts
| let redirectUri: string | undefined; | ||
| clientId = process.env.ROBLOX_CLIENT_ID; | ||
| redirectUri = `${process.env.PLANETARY_CLOUD_URL ? `https://${process.env.PLANETARY_CLOUD_URL}` : process.env.NEXTAUTH_URL || process.env.PUBLIC_URL}/api/auth/discord/callback`; | ||
| redirectUri = `${process.env.PLANETARY_CLOUD_URL ? `https://${process.env.PLANETARY_CLOUD_URL}` : process.env.NEXTAUTH_URL || process.env.PUBLIC_URL}/api/auth/roblox/callback`; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reuse the callback’s redirect URI resolution.
pages/api/auth/roblox/callback.ts honors ROBLOX_REDIRECT_URI and instanceConfig.robloxRedirectUri, but this line always derives the URI from base URL variables. When an override is configured, Roblox receives one redirect_uri during authorization and a different one during token exchange, causing the OAuth flow to fail. Use a shared resolver or identical precedence here.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pages/api/auth/roblox/start.ts` at line 18, Update the redirect URI
assignment in the Roblox start handler to use the same resolver and precedence
as the callback handler, including ROBLOX_REDIRECT_URI and
instanceConfig.robloxRedirectUri overrides before base URL fallbacks. Ensure
authorization and token exchange send the identical callback URI, preferably by
reusing the callback’s shared resolver.
|
I already had that fixed. Just didn't push. |
Not sure if this is right, but orbit is trying to use the discord redirect URL for roblox oauth
This is basically everything that i changed
Or is it like this on purpose?
Summary by CodeRabbit