Open chanmathew opened 3 months ago
My apologies... commenting again, because my previous one was from the test account.
How are you getting the screenshot output? I tried this with hosted Supabase, looked in the auth.users table in the dashboard, and the user metadata was there for the user. I also console.log'd the returned data
from the linkIdentity
method, and it also showed the user metadata.
@j4w8n I'm getting it in the authentication section, and then looking for my user:
Then I click on view user info:
It's also empty in the actual auth.users table:
I've tried both local dev and in the cloud dashboard, seems like the raw_user_meta_data is empty in both.
I'm sorry. I misunderstood what you were saying. I now understand that you mean the metadata that comes back from the OAuth provider.
After converting the user, if I logout and log back in with OAuth, then the data is there, but it would be nice if that data came back during the conversion.
Based on what I see in the data.url
of a conversion, it's authorizing directly to the OAuth provider:
'https://github.com/login/oauth/authorize?client_id=<redacted>&redirect_to=http%3A%2Flocalhost%3A5173%2Fself&redirect_uri=https%3A%2F%2F<redacted>.supabase.co%2Fauth%2Fv1%2Fcallback&response_type=code&scope=user%3Aemail&skip_http_redirect=true&state=<redacted>'
Versus an OAuth login data.url
:
https://<redacted>.supabase.co/auth/v1/authorize?provider=github&redirect_to=http%3A%2F%2Flocalhost%3A5173%2Fauth%2Fcallback%3Fnext%3D%2Fapp&code_challenge=l3tDoN9qS2u2B3rLXGidmfDcQRga9h3tbhM-w_U21FU&code_challenge_method=s256
I tried to work around it by adding something like ?refresh=true
to the redirectTo
option on linkIdentity
, so I could refresh the session myself, but the redirect never happens - I assume because it's authorizing directly to the provider, and in this case, I couldn't find any redirect url settings for GitHub, so it just sent me back to the app url set in the GitHub OAuth app.
@j4w8n Yeah that's right, the metadata doesn't come back during the conversion.
As for the redirectTo, my understanding is that it only redirects after the authentication, so I just use that to redirect to a specific page within my app.
I just came here because I ran into the same issue.
It is true that if the user logs out and in again after a supabase.auth.linkIdentity
the raw_user_meta_data
is there, but it should be there even with just linkIdentity
.
Any fix or workaround would be appreciated.
Same issue here. Would appreciate a workaround or a fix.
Bug report
Describe the bug
When calling
supabase.auth.linkIdentity
using the JS client, it does not return and store theraw_user_meta_data
that you would normally get when usingsupabase.auth.signInWithOAuth
:To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Expected behavior
It should return the metadata just like an oauth sign in.
Screenshots
When using supabase.auth.signInWithOAuth, it returns the raw_user_meta_data:
When using supabase.auth.linkIdentity, it does not return it:
System information
Additional context
It would be best if it can be returned as I want my postgres trigger to automatically add the full_name and avatar_url to my public.profiles table once the user's anonymous account has been converted to a permanent account once they've signed in.