Skip to content

Commit 38759e2

Browse files
committed
docs(README): note that full_name scope should be first in scope order
Fixes #293
1 parent 0ee9c43 commit 38759e2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ async function onAppleButtonPress() {
100100
// performs login request
101101
const appleAuthRequestResponse = await appleAuth.performRequest({
102102
requestedOperation: appleAuth.Operation.LOGIN,
103-
requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME],
103+
// Note: it appears putting FULL_NAME first is important, see issue #293
104+
requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
104105
});
105106

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

306307
1. Why does `full name` and `email` return `null`?
307308
- 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.
309+
- 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:
310+
```javascript
311+
const appleAuthRequestResponse = await appleAuth.performRequest({
312+
requestedOperation: appleAuth.Operation.LOGIN,
313+
requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
314+
});
315+
```
308316
- 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.
309317
- Keep in mind you can always access the `email` property server-side by inspecting the `id_token` returned from Apple when verifying the user.
310318

0 commit comments

Comments
 (0)