exchangeNativeSocial with Apple returns "invalid_request: Error from apple connection (no description)"

Native Apple Sign In fails silently via exchangeNativeSocial. Try Connection (web flow) works fine, so the .p8, Team ID, Key ID and Signing Key are all valid.

Environment

  • Tenant: dev-w6q3zpbobpnha4u6 (Development)
  • SDK: react-native-auth0 v4.6
  • App Type: Native (iOS)

Config

  • Apple Services ID: com.tst.smarttire.auth0 (with Domains + Return URLs pointing to tenant callback)
  • Apple Key linked to Primary App ID: com.tst.smarttire
  • Sign In with Apple capability enabled on the App ID
  • Auth0 Apple connection Client ID: com.tst.smarttire (Bundle ID)
  • App enabled on the connection

Flow

  1. iOS returns valid authorizationCode + identityToken (aud=com.tst.smarttire, verified by decoding the JWT)
  2. App calls auth0.auth.exchangeNativeSocial({ subjectToken: authorizationCode, subjectTokenType: ‘http://auth0.com/oauth/token-type/apple-authz-code’, … })

Log entry

  • Log ID: 90020260804161035780515000000000000001223372042739963715
  • Connection ID: con_6N3MrCwfn7XpW88f
  • type: fens
  • Apple’s response body is empty in the log

Tried both Bundle ID and Services ID as conn

Hi @sthiago,

Welcome to the Auth0 Community!

I understand that you are encountering an issue in setting up a Native Apple Connection and exchanging the Apple token for an Auth0 token.

The most common reason when receiving the “Error from apple connection: (no description)” error message is related to having a nonceEnabled parameter that defaults to true. Setting nonceEnabled to false allows Auth0 to exchange and validate the authorization code.

During a Native Flow via exchangeNativeSocial, your React Native app is the initiator. Your app requests the authorization code from iOS directly. Because Auth0 did not initiate this request, it has no context about the security parameters used. If those parameters do not match perfectly, Apple silently rejects Auth0’s validation attempt, resulting in the empty error response: Error from apple connection: (no description) (undefined).

In order to fix this, if your app does not strictly require nonce verification, disable it in your Apple Authentication configuration by setting a nonceEnabled: false flag, as mentioned by our Add Sign In with Apple to Native iOS Apps documentation as well. I would highly recommend checking all the steps listed here so they can match with your configuration, as well as the Token Exchange for Native Social page.

Other possible things to check in your configuration would be to:

  1. Ensure your Auth0 Dashboard is mapped correctly by setting the Client ID to your Apple Services ID (e.g., com.tst.smarttire.auth0) under Authentication > Social > Apple, and setting your Bundle ID to your iOS App Bundle ID (e.g., com.tst.smarttire) under Applications > [Your Native App] > Advanced Settings > Device Settings.

  2. Verify that the client_id parameter passed into your exchangeNativeSocial code is your Auth0 Application Client ID, not your Apple Bundle ID or Apple Services ID.

  3. Confirm that the subjectToken parameter in your payload is receiving the raw authorizationCode string returned by Apple, rather than the identityToken, since you are using the apple-authz-code token type.

Please let us know if this helped and if you have any other questions on the matter!
Best regards,
Remus