[GH-ISSUE #2513] Apple Sign In missing name scope when passing ID token #9235

Closed
opened 2026-04-13 04:39:21 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jnsvu on GitHub (May 2, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2513

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Sign in with expo-apple-authentication and pass the ID token to better-auth sign in request.
const authCredential = await AppleAuthentication.signInAsync({
  requestedScopes: [
    AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
    AppleAuthentication.AppleAuthenticationScope.EMAIL,
  ],
});

const result = await authClient.signIn.social({
  provider: "apple",
  idToken: {
    token: authCredential.identityToken
  }
});
...
  1. On the server side, try accessing the profile.name and notice it's not defined.
export const auth = betterAuth({
...
    socialProviders: {
      apple: {
        clientId: APPLE_CLIENT_ID,
        clientSecret: APPLE_CLIENT_SECRET,
        appBundleIdentifier: APPLE_BUNDLE_ID,
        scope: ["email", "name"],
        mapProfileToUser: (profile) => {

          const [firstName, lastName] = profile.name.split(" "); // name is undefined always
          return { ...profile, firstName, lastName };
        },
      },
...

Current vs. Expected behavior

Expo apple auth succesfully gives the name fields in the auth credential object, but I can't access the name on the server side. The email is retrieved without issues.

I'd expect the server side calls to retrieve the name related fields, or alternatively pass the name fields to authClient.signIn.social

What version of Better Auth are you using?

1.2.7

Provide environment information

- Expo 52.0.42
- Bun 1.2.10

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)


Additional context

No response

Originally created by @jnsvu on GitHub (May 2, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2513 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Sign in with expo-apple-authentication and pass the ID token to better-auth sign in request. ``` const authCredential = await AppleAuthentication.signInAsync({ requestedScopes: [ AppleAuthentication.AppleAuthenticationScope.FULL_NAME, AppleAuthentication.AppleAuthenticationScope.EMAIL, ], }); const result = await authClient.signIn.social({ provider: "apple", idToken: { token: authCredential.identityToken } }); ... ``` 2. On the server side, try accessing the `profile.name` and notice it's not defined. ``` export const auth = betterAuth({ ... socialProviders: { apple: { clientId: APPLE_CLIENT_ID, clientSecret: APPLE_CLIENT_SECRET, appBundleIdentifier: APPLE_BUNDLE_ID, scope: ["email", "name"], mapProfileToUser: (profile) => { const [firstName, lastName] = profile.name.split(" "); // name is undefined always return { ...profile, firstName, lastName }; }, }, ... ``` ### Current vs. Expected behavior Expo apple auth succesfully gives the name fields in the auth credential object, but I can't access the name on the server side. The email is retrieved without issues. I'd expect the server side calls to retrieve the name related fields, or alternatively pass the name fields to `authClient.signIn.social` ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash - Expo 52.0.42 - Bun 1.2.10 ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 04:39:21 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 1, 2025):

Hi, @jnsvu. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary

  • You reported that when using expo-apple-authentication with better-auth, the server does not receive the user's name from the Apple ID token.
  • The client provides the "name" scope, and the email is correctly retrieved.
  • However, profile.name is always undefined on the server side.
  • You expect either the server to access the name fields or the client to explicitly pass them during sign-in.
  • There has been no further activity or comments on this issue.

Next Steps

  • Please let me know if this issue is still relevant with the latest version of better-auth by commenting here.
  • If I do not hear back within 7 days, I will automatically close this issue.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3145055789 --> @dosubot[bot] commented on GitHub (Aug 1, 2025): Hi, @jnsvu. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary** - You reported that when using expo-apple-authentication with better-auth, the server does not receive the user's name from the Apple ID token. - The client provides the "name" scope, and the email is correctly retrieved. - However, `profile.name` is always undefined on the server side. - You expect either the server to access the name fields or the client to explicitly pass them during sign-in. - There has been no further activity or comments on this issue. **Next Steps** - Please let me know if this issue is still relevant with the latest version of better-auth by commenting here. - If I do not hear back within 7 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9235