Apple sign in firebase The identity provider configuration is not found

Viewed 38

New user do not appear in firebase Authentication section and in terminal i have that mistake:

The identity provider configuration is not found.

With calling function authorizationController all is ok, I also did not forgot to add new sign up metho in firebase, add new capability in Xcode and add new identifier via https://developer.apple.com/

So, what do I forgot to deal with?

Here is a part of my cod for apple sign in with firebase.

func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
        
        if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {

                // Save authorised user ID for future reference
                UserDefaults.standard.set(appleIDCredential.user, forKey: "appleAuthorizedUserIdKey")
                
                // Retrieve the secure nonce generated during Apple sign in
                guard let nonce = self.currentNonce else {
                    fatalError("Invalid state: A login callback was received, but no login request was sent.")
                }

                // Retrieve Apple identity token
                guard let appleIDToken = appleIDCredential.identityToken else {
                    print("Failed to fetch identity token")
                    return
                }

                // Convert Apple identity token to string
                guard let idTokenString = String(data: appleIDToken, encoding: .utf8) else {
                    print("Failed to decode identity token")
                    return
                }

                // Initialize a Firebase credential using secure nonce and Apple identity token
                let firebaseCredential = OAuthProvider.credential(withProviderID: "apple.com",
                                                                  idToken: idTokenString,
                                                                  rawNonce: nonce)
                    
                // Sign in with Firebase
                Auth.auth().signIn(with: firebaseCredential) { (authResult, error) in
                    
                    if let error = error {
                        print(error.localizedDescription, "231")
                        return
                    }
                    
                    // Mak a request to set user's display name on Firebase
                    let changeRequest = authResult?.user.createProfileChangeRequest()
                    changeRequest?.displayName = appleIDCredential.fullName?.givenName
                    changeRequest?.commitChanges(completion: { (error) in

                        if let error = error {
                            print(error.localizedDescription)
                        } else {
                            print("Updated display name: \(Auth.auth().currentUser!.displayName!)")
                        }
                    })
                }
                
            }
    }
0 Answers
Related