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

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

Merged
merged 3 commits into from
Apr 23, 2022
Merged

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

merged 3 commits into from
Apr 23, 2022

Conversation

RedChops
Copy link
Contributor

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
Copy link
Contributor Author

RedChops commented Apr 22, 2022

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.

… 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>
Signed-off-by: Joseph Schultz <joseph@acupofjose.com>
@acupofjose
Copy link
Collaborator

@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
Copy link
Contributor Author

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 acupofjose merged commit 466979b into supabase-community:master Apr 23, 2022
@acupofjose
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SendMagicLinkEmail puts RedirectTo option in incorrect part of request
2 participants