How to extract email from an Apple login's token?
kdn0325 opened this issue · 0 comments
kdn0325 commented
import { appleAuth } from '@invertase/react-native-apple-authentication';
import jwt_decode 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)
I am implementing Apple login using react-native and need to extract the email value of the user, so I am using jwt-decode to read the token file and read the email value. How do I extract the token file from react-native?
The library you use is
"react-native": "0.71.2",
"@invertase/react-native-apple-authentication": "^2.2.2",
"jwt-decode": "^4.0.0",
Please help me