Reputation: 871
https://firebase.google.com/docs/auth/ios/apple
I'm following guide in firebase apple login, and I got error 'Use of unresolved identifier 'OAuthProvider' even though I have included Firebase.
extension SignInWithAppleDelegates: ASAuthorizationControllerDelegate {
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
switch authorization.credential {
case let appleIdCredential as ASAuthorizationAppleIDCredential:
if let _ = appleIdCredential.email, let _ = appleIdCredential.fullName {
displayLog(credential: appleIdCredential)
}
signInSucceeded(true)
default:
break
}
// Initialize a Firebase credential.
let credential = OAuthProvider.credential(withProviderID: "apple.com",
idToken: idTokenString,
rawNonce: nonce)
// Sign in with Firebase.
Auth.auth().signIn(with: credential) { authResult, error in
if error {
// Error. If error.code == .MissingOrInvalidNonce, make sure
// you're sending the SHA256-hashed nonce as a hex string with
// your request to Apple.
print(error.localizedDescription)
return
}
// User is signed in to Firebase with Apple.
// ...
}
}
pod 'Firebase' is how I installed my firebase module.
Upvotes: 2
Views: 826
Reputation: 871
pod 'Firebase/Auth' was the solution. And in swift file, you have to
import FirebaseAuth
Upvotes: 3