linkIdentity() with Google
In my Supa app (Swift), authentication used to be through phone number. Now, it's through Google/Apple.
I'm trying to make changes such that, for my own user (which is only phone-authenticated), I can also sign in through my Google email. It's easier that way.
I couldn't find a way to link a Google account to my user in the Supa console, so I'm trying to do it through my app by calling
linkIdentity() when I'm already signed-in, and using .google as the provider.
This does open Google on a web browser, but it only shows a 500 error and nothing more.
I already added my /auth/v1/callback URL to the authorized redirect URIs in Google Cloud, I toggled on "Allow manual linking" on Supa, and I added my app's URL in the "Site URL" and "Redirect URLs" fields on Supa.
Still getting 500 with zero additional info. Am I doing something wrong? How can I get this working?
Thanks in advance!5 Replies
When you get the 500 is this on the Google portal or on the supabase.co website?
Did you also set your Google client id and secret in the dashboard?
The 500 is on the Google website I'm taken to.
And yes, I set my Google client id and secret in the dashboard. Sign-in with Google works just fine.
Normal sign in with google for Swift seems to use GoogleSignIn package but the linkIdentity doesn't have any mention of this which is rather confusing. https://supabase.com/docs/guides/auth/social-login/auth-google?queryGroups=environment&environment=server&queryGroups=platform&platform=swift
Agreed!
What should I do about this?
I was searching if there was anything on the GitHub discussions but it seems someone asked something similar and never got an answer https://github.com/orgs/supabase/discussions/27979
There is also this issue on the Supabase Swift repo, maybe you can leave a comment there or find something useful in there https://github.com/supabase/supabase-swift/issues/588
So there is a undocumented
linkIdentityWithIdToken method that was added which should allow you to use the GoogleSIgnIn I'm guessing and passing the IdToken to it.
I'm not sure if it does the same thing because the pull request mentioned OIDC and I don't do Swift apps so I cannot test this https://github.com/supabase/supabase-swift/pull/776
There is also some useful information here from folks who have tried to get this working https://github.com/supabase/supabase-swift/issues/221#issuecomment-2138401994