You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the "name" scope with sign-in with Apple, it doesn't seem like the "user" map that contains "firstName" and "lastName" is decoded, or added to the token map in OAuth2.callback/3. This means that when Strategy.Apple attempts to merge the name params into the other user params, nothing is there. In my application this results in "given_name" and "family_name" being absent when trying to insert a new user into the database.
I was able to fix this in my project by decoding the "user" map in OAuth2.callback/3, and assigning it to token before passing it off to fetch_user_with_strategy as follows:
Does this seem right? I've looked pretty closely at the code paths involved, and don't see any other place where this information seems to be handled. Happy to open a PR if this is a real issue, and if the fix seems appropriate!
The text was updated successfully, but these errors were encountered:
I've fixed it in #86, but haven't had the chance to test it out. Let me know if it works for you!
The reason I did it this way is that Apple for the most part adheres to the OIDC specs but not always. This is one such case. As I understand it, OIDC only permits code, state, and sometimes id_token to be returned in the auth code flow. OAuth 2.0 does permit additional params but they have to be explicitly recognized. And on top of that the value for the query param is JSON encoded.
When using the
"name"
scope with sign-in with Apple, it doesn't seem like the"user"
map that contains"firstName"
and"lastName"
is decoded, or added to thetoken
map inOAuth2.callback/3
. This means that whenStrategy.Apple
attempts to merge the name params into the other user params, nothing is there. In my application this results in"given_name"
and"family_name"
being absent when trying to insert a new user into the database.I was able to fix this in my project by decoding the
"user"
map inOAuth2.callback/3
, and assigning it totoken
before passing it off tofetch_user_with_strategy
as follows:Does this seem right? I've looked pretty closely at the code paths involved, and don't see any other place where this information seems to be handled. Happy to open a PR if this is a real issue, and if the fix seems appropriate!
The text was updated successfully, but these errors were encountered: