supabase: Authentication error messages poorly/not documented

Improve documentation

Link

Could potentially go in multiple places, e.g. just for email/password login auth docs or client docs.

Describe the problem

The potential return values of most of the auth functions are not documented, which makes it hard to handle potential errors client-side.

Describe the improvement

Include details of the potential messages the auth functions can return.

Could alternatively link to the gotrue docs if you wish to maintain a separation, however they would also need to be improved first as they currently list the only possible response as 200 success

Additional context

After manually working up through the dependancy tree to try and document the potential errors for the supabase-js signInWithPassword function figure out how to handle them in my project, i came up with the following list (links are to the part of the code that returns the error):

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 14
  • Comments: 16 (9 by maintainers)

Most upvoted comments

@superakabo Not every exception has an error code with it. For the getUser error, you can catch AuthSessionMissingException to handle it. This behavior aligns with the js SDK.

Hi @dshukertjr Interesting. AuthSessionMissingException could be thrown for other reasons. Anyway, if we go by this assumption, it will be difficult to differentiate between what is a bug and what is not. The error code adoption should be consistent for all APIs.

Hey @LukeHosk, thanks for pointing this out! The team is aware of this and are working on standardizing error messages. It might make most sense to wait for the standardization to be completed before documenting