Skip to content

Commit

Permalink
docs(README): use current jwt-decode style (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
tranminhnhat1005 authored Sep 12, 2024
1 parent 13c7150 commit cde56ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ All API documentation is generated by typedoc, and [is available in the `typedoc
- You can get the email address by parsing the JWT token that's returned from any authentication, like so:
```js
import { appleAuth } from '@invertase/react-native-apple-authentication';
import jwt_decode from 'jwt-decode';
import { jwtDecode } from 'jwt-decode';

const appleAuthRequestResponse = await appleAuth.performRequest({
requestedOperation: appleAuth.Operation.LOGIN,
requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME]
});
// other fields are available, but full name is not
const { email, email_verified, is_private_email, sub } = jwt_decode(appleAuthRequestResponse.identityToken)
const { email, email_verified, is_private_email, sub } = jwtDecode(appleAuthRequestResponse.identityToken)
```

## Troubleshooting
Expand Down

0 comments on commit cde56ac

Please sign in to comment.