fix: use absolute URL in portal handler unauthenticated redirect#527
fix: use absolute URL in portal handler unauthenticated redirect#527shafaladhikari wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 3 minutes and 7 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR fixes a crash in the portal handler when an unauthenticated request is made with a relative redirect URL, and adds a new TestAuth playground component for verifying authentication and role data during development. ChangesAuth handler and testing updates
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 `@playground/src/components/test-auth.tsx`:
- Around line 11-15: The useEffect calls printRoles but doesn't list it in
dependencies causing an exhaustive-deps violation; either move the printRoles
implementation inside the useEffect that depends on isAuthenticated (so only
isAuthenticated stays in the dependency array) or wrap the component-level
printRoles with useCallback and add printRoles to the dependency array; update
the useEffect signature to reference the corrected dependency setup (useEffect,
isAuthenticated, printRoles).
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e9fe1701-d5a3-4513-9137-4bc3949d9143
📒 Files selected for processing (2)
playground/src/components/test-auth.tsxsrc/handlers/portal.ts
Explain your changes
Fixes #523
The portal handler redirected unauthenticated requests using a relative path:
NextResponse.redirect()requires an absolute URL, so this crashed withError: URL is malformed "/api/auth/login"in App Router.Fixed by prepending
config.redirectURL(i.e.KINDE_SITE_URL) to produce an absolute URL, consistent with howcallback.tsalready constructs the same redirect:Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.