Open tvogel opened 1 week ago
Ah, by the way, a similar issue appears with verifyOtp()
even though, here, the JSON in fact looks like:
{"code":"otp_expired","message":"Token has expired or is invalid"}
but still, the code does not make it into the error object:
AuthApiError: Token has expired or is invalid
__isAuthError: true
code: undefined
columnNumber: 5
fileName: "http://localhost/node_modules/.vite/deps/@supabase_supabase-js.js?v=71e4d0b2"
lineNumber: 3828
message: "Token has expired or is invalid"
name: "AuthApiError"
stack: <removed>
status: 403
Could it be that the API version check fails because GoTrue is not exposing the version header to the script, see:
This is with my local
supabase start
environment (which might have an effect on the GoTrue version?):When I get an authentication failure from
auth-js
, e.g. because of an invalid password, I do not get the usefulinvalid_grant
error code but instead, it isundefined
(fromconsole.dir(error)
):This seems to be because, in
https://github.com/supabase/auth-js/blob/f131300d753634fcf3fbc93dc7a762031f096749/src/lib/fetch.ts#L59
and below, it is checking only for
data.code
anddata.error_code
. It seems to me thatdata.error
should be checked as well, because that is what I see in the JSON reply in the network packet:Because I am not aware what protocol version checks might be necessary, I won't try to file a pull request. (Also, I was not successful setting up a local version of
auth-js
.)