Skip to content

Commit

Permalink
docs(README): note that full_name scope should be first in scope order
Browse files Browse the repository at this point in the history
Fixes #293
  • Loading branch information
mikehardy committed Sep 17, 2022
1 parent 0ee9c43 commit 38759e2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ async function onAppleButtonPress() {
// performs login request
const appleAuthRequestResponse = await appleAuth.performRequest({
requestedOperation: appleAuth.Operation.LOGIN,
requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME],
// Note: it appears putting FULL_NAME first is important, see issue #293
requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
});

// get current authentication state for user
Expand Down Expand Up @@ -305,6 +306,13 @@ All API documentation is generated by typedoc, and [is available in the `typedoc

1. Why does `full name` and `email` return `null`?
- Apple only returns the `full name` and `email` on the first login, it will return `null` on the succeeding login so you need to save those data.
- Apple APIs [appear to be sensitive to the order you place the scopes in the auth request](https://github.com/invertase/react-native-apple-authentication/issues/293). Place first name *first*, like this:
```javascript
const appleAuthRequestResponse = await appleAuth.performRequest({
requestedOperation: appleAuth.Operation.LOGIN,
requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
});
```
- For testing purposes, to be receive these again, go to your device settings; `Settings > Apple ID, iCloud, iTunes & App Store > Password & Security > Apps Using Your Apple ID`, tap on your app and tap `Stop Using Apple ID`. You can now sign-in again and you'll receive the `full name` and `email.
- Keep in mind you can always access the `email` property server-side by inspecting the `id_token` returned from Apple when verifying the user.

Expand Down

0 comments on commit 38759e2

Please sign in to comment.