I’m getting this error when try to exchange successfuly fetched apple authorization code by auth0 token.
Error message is “Error from apple connection: (no description) (undefined)”
Next time I try to use the same authorization code I will get expected error that invalid_grant.
Here is auth0 log item (omitted sensitive data)
{
“type”: “fens”,
“description”: “Error from apple connection: (no description) (undefined)”,
“connection”: “apple”,
“details”: {
“subject_token_type”: “http://auth0.com/oauth/token-type/apple-authz-code”
},
“user_id”: “”,
“user_name”: “”
}
One of our developer support engineers is for sure on your ticket by now @MaxSchmeling. So as not to multiply efforts can you share the solution here in the thread once they share it with you? Thanks!
For now, I’m working on exchanging the authorization code for a token with Apple directly to see if I can get any more clarity about the error that way.
I’m following the directions here because I assume this is the endpoint that Auth0 is calling with the authorization code, but I don’t know for sure: Apple Developer Documentation
Thanks for the feedback and I’m sorry this issue is taking so long to address. I’ve added @Knight704’s experience to the engineering ticket and I’m trying to get some action on it.
I’m using the @invertase/react-native-apple-authentication package in a react-native application. The performRequest method that starts the Apple ID flow has a nonceEnabled parameter that defaults to true. The nonce is what was causing the issue. Setting nonceEnabled to false allows Auth0 to exchange and validate the authorization code.
@MaxSchmeling That makes sense–we don’t know the nonce so it’s correct for Apple to reject the exchange without it. I am having engineering look into if there is a message to that effect from Apple and if we can pass that on to our users to make troubleshooting easier.
@Knight704 Does this solution apply to you? Are you sending a nonce when you request the authorization code from Apple?
I’ve managed to solve it. The problem was the encoding of the request. I used the axios library which seems to have a bug with urlencoded parameters. So i had to stringify the body first, before sending the data to the request. The nonce has to be false as mentioned, thanks for that!