I am trying to Sign in with Apple
using Auth0
.
But the permission message shows my app name as null
This is the permission message.
Do you want to sign in to
null
with you Apple ID "myAppleId@email.com"?
The logo of my app is showing correctly. It is the app name that is showing null
Where do I set the app name?
Edit: Here is how it looks -
If trying with Auth0, you can go with the following way to solve this problem.
Step 1.
if #available(iOS 13.0, *) {
// Create the authorization request
let request = ASAuthorizationAppleIDProvider().createRequest()
// Set scopes
request.requestedScopes = [.email, .fullName]
// Setup a controller to display the authorization flow
let controller = ASAuthorizationController(authorizationRequests: [request])
// Set delegates to handle the flow response.
controller.delegate = self
controller.presentationContextProvider = self
// Action
controller.performRequests()
}
Step 2
Implement the delegate method and get apple's authorization code there.
extension ViewController: ASAuthorizationControllerDelegate {
@available(iOS 13.0, *)
func authorizationController(controller: ASAuthorizationController,
didCompleteWithAuthorization authorization: ASAuthorization) {
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
// Success
guard let authorizationCode = appleIDCredential.authorizationCode,
let authCode = String(data: authorizationCode, encoding: .utf8) else {
print("Problem with the authorizationCode")
return
}
}
}
}
Step 3
Now you use this authCode
to login to the Auth0.
func appleSignin(with authCode: String) {
Auth0.authentication().tokenExchange(withAppleAuthorizationCode: authCode)
.start { result in
switch result {
case .success(let credentials):
//LoginSucces
case .failure(let error):
//Issue with login.
}
}
}
In this method, you don't show the webview like for other login methods with Auth0.
I had posted this on Auth0 Community (the issue that I posted here), and one of their engineers replied me to approach it this way.
Check this out for more info Sign in with Apple - Auth0