auth icon indicating copy to clipboard operation
auth copied to clipboard

Handle 400 error from supabase.co/auth/v1/callback with a redirect to an error page

Open rdinicut opened this issue 1 year ago • 17 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] 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:

  1. go to https://supabase-vercel-integration.vercel.app/
  2. Click on sign in with Google
  3. When on the sign in Google page, go make a coffee(wait 10 min to be sure)
  4. Come back
  5. Finish the sing in
  6. 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

rdinicut avatar May 30 '23 16:05 rdinicut