Open dhruvbhatia opened 3 days ago
Looking into this further, I decoded the credential.identityToken
JWT token and found it no longer contains an email
key (instead, the email
is stored as a top level key within the credential
object itself - as shown in my original post). Hence when credential.identityToken
gets passed to Supabase's signInWithIdToken
, it doesn't see any email address (but creates the auth record regardless).
This is what credential.identityToken
looks like - note the absence of the email field:
{
"iss": "https://appleid.apple.com",
"aud": "com.company.appname",
"exp": 1731569098,
"iat": 1731482698,
"sub": "<some uid of the user>",
"c_hash": "<some hash>",
"auth_time": 1731482698,
"nonce_supported": true
}
So I'm guessing Apple has changed the structure of what the identity token JWT returns (though their documentation still says the email
field should be present).
Perhaps Supabase should take the entire credential
object rather than just the credential.identityToken
JWT token? That way it'll have access to the top level email
field (as well as fullName
and any other user info shared during auth)...
Bug report
Apple Authentication via
supabase.auth.signInWithIdToken
creates a record without theEmail
orDisplay name
fields in Supabase Auth (despite the user providing these during the Auth process).This used to work properly a couple of weeks ago, so I believe it's a recent problem with Supabase / Supabase JS / Apple's endpoint.
Describe the bug flow
An iOS user authenticates via Apple Auth and chooses to share their name and email:
expo-apple-authentication correctly returns this
credential
object:Which is then sent to to Supabase via
signInWithIdToken
:Supabase signs the user in and the
SIGNED_IN
auth state is set, as expected.However, looking at the Supabase Auth UI, the Email and Display name fields are not set:
This is obviously problematic as the scoped values that the user shared are not being populated. To reiterate, this used to work properly in the past so something must have broken it recently. Assistance appreciated.
To Reproduce
Email
andDisplay name
fields are not populatedHere's the relevant code for this:
Expected behavior
Upon creating a Supabase record for a user authenticating via Apple, the
Email
andDisplay name
fields should be set (if shared).System information
Additional context
This may be related to #899, though I didn't see anybody have issues with the
Email
field not populating there.