I am getting an error using Apple Sign In with Firebase Auth: "MISSING_OR_INVALID_NONCE : Nonce is missing in the request."
The only other case I've been able to find is similar to the following question, however their solution of updating the pod file does not work.
Cause of error setting up Sign in with Apple for Firebase in Swift on iOS 13?
Error:
Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={FIRAuthErrorUserInfoNameKey=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information., NSUnderlyingError=0x2807c6ee0 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
code = 400;
errors = (
{
domain = global;
message = "MISSING_OR_INVALID_NONCE : Nonce is missing in the request.";
reason = invalid;
}
);
message = "MISSING_OR_INVALID_NONCE : Nonce is missing in the request.";
}}}}
Login Button Clicked Method:
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email]
let nonce = randomNonceString()
currentNonce = nonce
request.nonce = sha256(nonce)
Section in ASAuthorizationController:
let firebaseCredential = OAuthProvider.credential(withProviderID: "apple.com", idToken: identityToken!, accessToken: currentNonce)
Printing the nonce values after being set, before being sent as a parameter shows that they are indeed the same, added to the appropriate requests, but the service is still giving me this error.
The BundleID is the same in firebase and GoogleService-Info.plist, the app works with Google Sign In and Firebase. I've tried sending the raw nonce, the hashed nonce, different hash methods, everything seems to be okay except for this one thing, and there's no real way to debug it.