-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Sign in with Apple Display Name API and unit test #10068
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One initial comment: Please remove the files under AuthSample.xcodeproj
and xcshareddata/xcschemes
, as well as Application.plist
from the PR -- these files should only be updated locally.
I'll take a more in-depth look at this later today!
FirebaseAuth/Sources/AuthProvider/OAuth/FIROAuthCredential_Internal.h
Outdated
Show resolved
Hide resolved
…under Sample" This reverts commit 8578f96.
…o add displayname
Size Report 1Affected ProductsTest Logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
So does this mean the display name is auto-updated so there is no need to update display name with appleIDCredential? |
After receiving Here is the relevant code snippet from the documentation: @available(iOS 13.0, *)
extension MainViewController: ASAuthorizationControllerDelegate {
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
guard let nonce = currentNonce else {
fatalError("Invalid state: A login callback was received, but no login request was sent.")
}
guard let appleIDToken = appleIDCredential.identityToken else {
print("Unable to fetch identity token")
return
}
guard let idTokenString = String(data: appleIDToken, encoding: .utf8) else {
print("Unable to serialize token string from data: \(appleIDToken.debugDescription)")
return
}
// Initialize a Firebase credential, including the user's full name.
let credential = OAuthProvider.appleCredential(withIDToken: idTokenString,
rawNonce: nonce,
fullName: appleIDCredential.fullName)
// 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.
// ...
}
}
}
func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) {
// Handle error.
print("Sign in with Apple errored: \(error)")
}
} As you can see, you no longer need to update the user's |
This is Awesome Thanks Peter |
@peterfriese I feel like I'm missing something. In the |
@LilaQ are you using the local emulator? If I run my app connected to the local emulator for authentication, I don't see full name getting populated, but if I connect to the my live Firebase app, it is working as expected with 10.7.0. |
Discussion
Testing
FIROAuthProviderTest
andFIRAuthTest
API Changes