supabase-community / gotrue-csharp

C# implementation of Supabase's GoTrue
https://supabase-community.github.io/gotrue-csharp/api/Supabase.Gotrue.Client.html
MIT License
39 stars 27 forks source link

SendMagicLinkEmail puts RedirectTo option in incorrect part of request #29

Closed RedChops closed 2 years ago

RedChops commented 2 years ago

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 commented 2 years ago

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