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

feat: ✨ add flag to disable getSession after signIn on local / refresh provider #701

Closed
3 of 5 tasks
bitfactory-frank-spee opened this issue Mar 5, 2024 · 2 comments · Fixed by #702
Closed
3 of 5 tasks
Labels
enhancement An improvement that needs to be added

Comments

@bitfactory-frank-spee
Copy link
Contributor

bitfactory-frank-spee commented Mar 5, 2024

Describe the feature

With the signIn method it should be possible to optionally do a getSession so you can manually call for session data and manually handle the errors coming from the getSession endpoint.

How would you implement this?

I created a PR: #702

Additional information

  • Would you be willing to help implement this feature?

Some extra information why we need this:

Our 2FA/OTP middleware on the Laravel API returns a 428 error on user/me (or any other endpoint if 2FA is needed). The signIn method always calls getSession, and the error from the user/me API endpoint dies in getSession (clearing the token etc.). Because this catch we need to manually call the user/me endpoint outside this module. So right now we want to prevent the getSession getting called so we still have the token etc. and call it manually.

Another solution could also be to allow the API error(s) from getSession bubble through (and not clear the token etc. immediately) or create some kind of hook so we can intercept on special errors like a 428. This is more work and need more design to be able to create this for local and refresh provider without drifting to far from the authjs provider.

Provider

  • AuthJS
  • Local
  • Refresh
  • New Provider
@bitfactory-frank-spee bitfactory-frank-spee added enhancement An improvement that needs to be added pending An issue waiting for triage labels Mar 5, 2024
@zoey-kaiser zoey-kaiser removed the pending An issue waiting for triage label Mar 7, 2024
@bitfactory-frank-spee
Copy link
Contributor Author

@zoey-kaiser Thanks for releasing this! 🚀

@zoey-kaiser
Copy link
Member

Thank you for pushing this and being so patient ❤️ Happy holidays and have a great start into your new year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement that needs to be added
Projects
None yet
2 participants