Auth0 apple id login doesn't include given_name or family_name

Hey, I’m creating this thread because I’m not getting the given_name and family_name on the IdToken using the apple connection.

I read this ticket with a similar issue (LastName FirstName in token with apple-signin - #9 by codenameredpanda), taking the idea from there i write the following action without luck (I’m getting not firstname and not last_name on the idToken).

  
  const { user } = event;  

  if (event.connection.strategy === "apple") {        
    api.idToken.setCustomClaim('given_name', user.first_name || 'not firstname');
    api.idToken.setCustomClaim('family_name', user.last_name || 'not last_name');
  }   

  return { user };
};

I also try to debug a logging the user object included on the event but there was no name related information there

I’m using development keys and testing with the “Try Connection” button on the apple connection.

I did try to completely delete the account on auth0 and remove the connection on my Apple ID, but there was no effect. ( as is mentioned here Apple review requirement for firstName and lastName - #5 by lihua.zhang)

This is an example of what I’m getting on the idToken

{
  "sub": "apple|000965.a13368916e6a44a9af796510610XXXX4.1937",
  "given_name": "not last_name",
  "family_name": "not last_name",
  "nickname": "thejuasz",
  "name": "thejuasz@gmail.com",
  "picture": "https://s.gravatar.com/avatar/b9ba3706674645f2f2c5ffe1a9661b17?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fth.png",
  "updated_at": "2023-07-12T00:34:19.719Z"
}

I’m totally sure that I’m sharing my name and email on my apple account

What could I do?

Thanks in advance

Hey there @juan.portugal welcome to the community!

Thanks a bunch for the detailed description - Do you see those values included in the user profile when you GET a Apple federated user at /api/v2/users/{id}? Your code looks fine to me - I experience the same issue in my own environment, but I did notice that the user profile of the Apple user I was testing with doesn’t include a first_name nor last_name attribute.

Keep us posted!

Hi @juan.portugal, were you able to solve this issue?

Hi!
We also have the same issue and first_name/last_name is missing from Apple. I have these data in ‘Raw JSON’ tab for this user in Auth0’s dashboard, on our DEV env/tenant:

{
    "created_at": "2023-08-09T10:24:02.328Z",
    "email": "moientajik1@gmail.com",
    "email_verified": "true",
    "identities": [
        {
            "user_id": "001627.1b77447387d9467fb86ebc237b126781.1123",
            "provider": "apple",
            "connection": "apple",
            "isSocial": true
        }
    ],
    "name": "moientajik1@gmail.com",
    "nickname": "moientajik1",
    "nonce_supported": true,
    "picture": "https://s.gravatar.com/avatar/27f98c6bf62472b2f6e5437ebafdbef4?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fmo.png",
    "updated_at": "2023-08-09T10:24:02.328Z",
    "user_id": "apple|001627.1b77447387d9467fb86ebc237b126781.1123",
    "last_ip": "85.145.X.X",
    "last_login": "2023-08-09T10:24:02.327Z",
    "logins_count": 1,
    "blocked_for": [],
    "guardian_authenticators": []
}

But on Production env, we have both first_name and last_name for the same account!:

{
    "created_at": "2023-08-09T10:44:27.305Z",
    "email": "moientajik1@gmail.com",
    "email_verified": "true",
    "first_name": "Moien",
    "identities": [
        {
            "user_id": "001627.e49c93eb5cb8465293701a3b9ad45d08.1004",
            "provider": "apple",
            "connection": "apple",
            "isSocial": true
        }
    ],
    "last_name": "Tajik",
    "name": "Moien Tajik",
    "nickname": "moientajik1",
    "nonce_supported": true,
    "picture": "https://s.gravatar.com/avatar/27f98c6bf62472b2f6e5437ebafdbef4?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fmt.png",
    "updated_at": "2023-08-09T10:44:30.652Z",
    "user_id": "apple|001627.e49c93eb5cb8465293701a3b9ad45d08.1004",
    "app_metadata": {
        "existsInBurnwood": true
    },
    "last_ip": "85.145.X.X",
    "last_login": "2023-08-09T10:44:27.303Z",
    "logins_count": 1,
    "blocked_for": [],
    "guardian_authenticators": []
}

@tyf

why there is no solution to problem from Auth0, I have seen many posts related to this and no solution from Auth0. There is no first_name, last_name in the event.user in actions. Are those fields avoided event.user for some reason?

@moien.tajik Were you able to find a solution for this ?

Also need a solution for this. It is a blocker…

Here Anyone got the solution? It is blocking my release of the application.

It is necessary to configure the Apple account settings in Auth0 console. On Auth0 dev keys you will not be able to get those details.