"Sign in with Apple" gives different `user` in Expo and TestFlight

I am using Sign In with Apple as per the Expo AppleAuthentication documentation, and it works well.

But it returns a different user variable when I login from Expo and TestFlight (using a binary built with expo cli) using the same Apple ID.

I assume this is because Apple sees the Expo app and the TestFlight app as separate apps, and thus returns a different user variable. But since I am using the user as the unique identifier (as recommended by Apple), and my team goes back and forth between Expo and TestFlight, it causes a problem.

There may be no way around this limitation, but perhaps someone has an idea. For what it’s worth , the user variable has the form xxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.zzzz and the xxxxxx is the same when I login from Expo and TestFlight, but the rest is different.

Thanks in advance.

Hey @greg_mtl,

This is expected and we mention it here in the docs: https://docs.expo.io/versions/v35.0.0/sdk/apple-authentication/#development-and-testing

I’m currently pushing a change to reword it to say “standalone apps” rather than “production” to avoid further confusion.


Thanks for the reply @adamjnav. Makes sense. I never did this last step in your docs (forgot), but my standalone app still works fine with Sign In with Apple. Would you recommend I do it for the next build, or leave well-enough alone?

  1. Finally, when you want to make a standalone build to test with, run expo build:ios --clear-provisioning-profile --revoke-credentials so that your provisioning profile is regenerated with the new entitlement.

Sorry to hijack your thread, @greg_mtl, but I can’t seem to get help with Sign in with Apple anywhere and you seem like you might be the only (active) person on here who’s at least tried t get it working.

I have it mostly set up, to the point that I get the credential back from Apple (containing authorizationCode, identityToken, name, email, etc.). I pass the authorizationCode to my server where I’m trying to then hit Apple’s auth endpoint and validate it but it’s just not working. Instead of a 200 and a token returned, I’m getting a 400 with Bad Request (“invalid_grant”). Are you also trying to validate the returned code with Apple using their endpoint (Apple docs here)?

I’m completely lost right now. The Expo Sign in with Apple docs don’t mention anything about a redirect_uri but Apple apparently need one when validating a token this way. Any ideas? Thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.