Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SendMagicLinkEmail puts RedirectTo option in incorrect part of request #29

Closed
RedChops opened this issue Apr 22, 2022 · 1 comment · Fixed by #30
Closed

SendMagicLinkEmail puts RedirectTo option in incorrect part of request #29

RedChops opened this issue Apr 22, 2022 · 1 comment · Fixed by #30
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@RedChops
Copy link
Contributor

It seems like SendMagicLinkEmail appends RedirectTo to the POST body of the request, but it looks like the server expects it to be a query parameter. When a magic link is requested using this library using a redirect_to option, the magic link returned from the server ignores the option passed.

I spun up a Supabase instance here so I could dump the request data and used two client environments: a Flutter app which I know works, and a C# app which does not, both using the same API.

When requesting a magic link using the flutter library, it makes a request to the server like so:
POST /auth/v1/magiclink?redirect_to=com.example.example%3A%2F%2Flogin-callback%2F HTTP/1.1" 200 2 "-" "Dart/2.16 (dart:io)
with a POST body of:
{\x22email\x22:\x22email@example.com\x22}

Using this C# library, the request instead looks like this:
POST /auth/v1/magiclink HTTP/1.1" 429 91 "-" "Dalvik/2.1.0 (Linux; U; Android 12; sdk_gphone64_x86_64 Build/SPB5.210812.003)
with a POST body of:
{\x22email\x22:\x22email@example.com\x22,\x22redirect_to\x22:\x22com.example.example://login-callback/\x22}

@acupofjose
Copy link
Collaborator

@RedChops thanks for researching the issue! I’ll make the changes tonight to fix it - will update you later

@acupofjose acupofjose added bug Something isn't working good first issue Good for newcomers labels Apr 22, 2022
acupofjose added a commit to acupofjose/gotrue-csharp that referenced this issue Apr 23, 2022
…rameter instead of POST data

`GetSessionFromUrl` accounts for gotrue sending a url of the format: `http://localhost:9000?status=success#access_token=blahblah`

Signed-off-by: Joseph Schultz <joseph@acupofjose.com>
acupofjose pushed a commit that referenced this issue Apr 23, 2022
* Update usage of redirectTo to reflect gotrue-js usage

* Fixes #29 by changing `redirect_to` into a query parameter instead of POST data
`GetSessionFromUrl` accounts for gotrue sending a url of the format: `http://localhost:9000?status=success#access_token=blahblah`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
2 participants