To initiate login call the
This will initiate the sign in process and present the "Sign In with Apple" UI.
You can pass a few options to the login function allowing you to control some aspects of the process. Mainly whether the email and full name of the user should be requested.
This is done by passing an instance of the
AppleSignInOptions to the
For example, to request both the email and full name scopes:
Important: To sign in with an Apple account, users must:
- Have an Apple ID with two-factor authentication (2FA) enabled.
- Be signed in to iCloud on an Apple device.
See How to use Sign in with Apple. You will also need to meet these requirements to test your integration with Sign In with Apple.
If you are deploying to Android as well then you will need to provide your Service ID (client id) and redirect url in the options.
The client id is the identifier used to create your Service ID in the apple developer console.
The redirect url is one of the urls you entered when creating your Service ID that you intend to use for this login request.
These values are ignored on iOS.
During the login process you will receive one of the following events:
AppleSignInEvent.SUCCESS: Upon successfully authentication;
AppleSignInErrorEvent.ERROR: If an error occurred during login;
You should listen for both of these events and handle accordingly.
You can access the "nonce" used to initiate this authorisation request in the success handler via the
event.rawNonce property. This can be used to further authenticate with services such as Firebase.
The user can revoke the authentication through their apple account. You can listen for a revoke event which will be dispatched if the authentication is ever revoked by the user:
With Android the process uses a webview and the OAuth web login.
In order to successfully complete this process you need to setup a server that will exchange the authorisation code for the identity token and user.
There are a few differences with this process that you should be aware of as it will affect how you implement login on Android.
- User's name components are only returned the first time they log in.