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

Update usage of redirectTo to reflect gotrue-js usage #30

Closed RedChops closed 2 years ago

RedChops commented 2 years ago

Fixes #29

I just saw your message, I already had this built up and testing it out, so you can feel free to use this!

RedChops commented 2 years ago

The only slightly dodgy thing here is that when the URI comes back in from the redirect, the query string part is actually a query string-encoded fragment. This affects the HttpUtility.ParseQueryString(uri.Query) call in GetSessionFromUrl, since uri.Query is null.

I worked around this by adjusting my call to

var uri = new Uri(Intent.Data.ToString().Replace("#", "?"));
client.GetSessionFromUrl(uri);

but that's probably not ideal.

acupofjose commented 2 years ago

@RedChops I opened a separate PR to make changes, but saw that you actually let me commit onto yours directly (whoops). Thanks for taking the time to open this, really nice to have your contribution!

I would rather use the built-in UriBuilder to handle adding the redirect_to into the query, so you'll see those changes there. I also took your suggestion and adjusted the client.GetSessionFromUrl() (with a slight adjustment).

Will you check those changes and see if they work well for you?

RedChops commented 2 years ago

Happy to help!

The updates look great, I prefer the UriBuilder as well. I loaded up the new version in my application and it works perfectly well

acupofjose commented 2 years ago

Awesome, I'll bundle a release and credit you in the CHANGELOG - let me know if you find anything else in the future!