auth: Handle 400 error from supabase.co/auth/v1/callback with a redirect to an error page
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When signing in with social Auth, for example Azure it seems that the callback has a timeout and if the users waits to long to login the callback fails with {"code":400,"msg":"OAuth state is invalid: token is expired by ..."} This breaks the flow and it is a very bad UX.
In my opinion the supabase callback should redirect with some timeout error in order for the application to handle this, for example tell the user to retry the flow.
To Reproduce
Steps to reproduce the behaviour, please provide code snippets or a repository:
- go to https://supabase-vercel-integration.vercel.app/
- Click on sign in with Google
- When on the sign in Google page, go make a coffee(wait 10 min to be sure)
- Come back
- Finish the sing in
- get the 400 error shown in JSON
Expected behaviour
FEATURE REQUEST: Redirect to an app url with a timeout error
System information
- OS: MacOs
- Browser : Chrome
- Version of supabase-js: ^2.22.0
- Version of Node.js: v18.16.0
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 16
- Comments: 18 (4 by maintainers)
Happened to me today when debugging my sign-in-with-apple flow. Would be great if this was handled in a more user-friendly way, such as redirecting back to the app with an error message instead of just showing the user JSON.
same here, any update or fix? thanks
This shouldn’t be the case, it’s really frustrating to show the user a json response
Exactly that. An authentication server should never return a json output like this, but instead redirect the error as part of the url back to the application like it happens for other oidc errors. I would also suggest classifying this as a bug instead of enhancment, as showing an error like that is against oidc standard and breaks login.
I’m also in the process of looking for a workaround for this with self-hosted supabase and currently I’m entertaining the idea of making kong recognize this type of url and redirect the user accordingly.
Hi @encima, thank you for your reply, the problem is not the access request expiration, but what happens after the expiration.
It’s correct to throw error but as stated by LHDi, the user will see a json response, it should be better to allow us to add a redirect url to the app with a custom message.
Same issue with Google
I have the same issue with sign-in-with-google 😦