Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #3244] auth login home and error redirects #3470

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

doug-s-nava
Copy link
Collaborator

Summary

Fixes #3244

Time to review: 10 mins

Changes proposed

  • the callback route, which previously routed to the User page for all cases with different string messages, will now redirect to the home page on success, or an unauthorized page if no token is present or error page in error cases
  • created error and unauthorized pages
  • added middleware to implement the correct status codes on these redirects

Note that the error handling here is temporary for phase one, we will revisit as per this ticket for the next phase #3341

Context for reviewers

Testing steps

  1. start with npm run dev on this branch
  2. visit http://localhost:3000?_ff=authOn:true and log in
  3. VERIFY: on successful login you're returned to the home page
  4. visit htp://localhost:3000/api/auth/callback (note no token is present)
  5. VERIFY: you're redirected to the unauthorized page
  6. simulate an error by throwing from line 12 of the callback route
  7. attempt login
  8. VERIFY: you're redirected to the error page

Additional information

Screenshots, GIF demos, code examples or output to help show the changes working as expected.

@doug-s-nava doug-s-nava marked this pull request as ready for review January 9, 2025 15:43
Copy link
Collaborator

@acouch acouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏿

@doug-s-nava doug-s-nava force-pushed the dschrashun/3244-login-redirects branch from 8e20429 to ac89846 Compare January 10, 2025 18:43
@doug-s-nava doug-s-nava merged commit 65221c5 into feature/nextjs-auth Jan 10, 2025
8 checks passed
@doug-s-nava doug-s-nava deleted the dschrashun/3244-login-redirects branch January 10, 2025 19:05
acouch pushed a commit that referenced this pull request Jan 13, 2025
* the callback route redirects to the home page on success, or an unauthorized page if no token is present or error page in error cases
* creates error and unauthorized pages
* adds middleware to implement the correct status codes on these redirects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants