Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

VerifyForUser function returns success JSON response in error #11

Open
thisisthemurph opened this issue Sep 22, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@thisisthemurph
Copy link

Bug report

Describe the bug

I'm using the VerifyForUser function (here) to verify an OTP during my password reset process.

I note that I am getting a response of nill, error and the error is essentially a JSON string of the 200 success result. On line 142 it is checking to ensure the response from the server is http.StatusSeeOther and if it is not, it places the response in the body of the error, even though it is a 200 OK in this case.

To Reproduce

Here is a snippet of the code I used that results in this behaviour:

_, err := h.Supabase.Auth.VerifyForUser(types.VerifyForUserRequest{
	Type:       "recovery",
	Token:      req.OTP,
	Email:      req.Email,
	RedirectTo: h.Config.ClientBaseURL + "/auth/password-reset",
})

// Here I have my own function for parsing the success session response from the error 
session, jsonParseErr := sbext.ParseSessionFromErrJson(err)

Expected behavior

I would have expected a 200 response to be returned as the first param, not in the error.

System information

Snippets from my go.mod file:

require(
	github.com/supabase-community/gotrue-go v1.2.0
	github.com/supabase-community/supabase-go v0.0.4
        github.com/supabase-community/functions-go v0.1.0 // indirect
	github.com/supabase-community/postgrest-go v0.0.11 // indirect
	github.com/supabase-community/storage-go v0.7.0 // indirect
)

Additional context

This could be because I have the incorrect process or that I am using the incorrect function. I noted that there is a Verify function above that uses GET rather than POST. I may look at that at some point, but my current method is actually working right now.

@thisisthemurph thisisthemurph added the bug Something isn't working label Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant