The current Apple Authorization state.
This is an exported member, AppleAuthCredentialState
from the react-native-apple-authentication
library. This is used to
check the user's current authorization state after a appleAuth.getCredentialStateForUser(user)
request has been made.
import appleAuth, {
AppleAuthRequestOperation,
AppleAuthRequestScope,
AppleAuthCredentialState,
} from '@invertase/react-native-apple-authentication';
async function onPressAppleButton() {
const requestOptions = {
requestedOperation: AppleAuthRequestOperation.LOGIN,
requestedScopes: [AppleAuthRequestScope.EMAIL, AppleAuthRequestScope.FULL_NAME],
};
const { user } = await appleAuth.performRequest(requestOptions);
const credentialState = await appleAuth.getCredentialStateForUser(user);
if (credentialState === AppleAuthCredentialState.AUTHORIZED) {
//user is authorized
}
if (credentialState === AppleAuthCredentialState.NOT_FOUND) {
}
if (credentialState === AppleAuthCredentialState.REVOKED) {
}
if (credentialState === AppleAuthCredentialState.TRANSFERRED) {
}
}
• AUTHORIZED:
Defined in lib/index.d.ts:83
The Opaque user ID is in good state.
• NOT_FOUND:
Defined in lib/index.d.ts:88
The Opaque user ID was not found.
• REVOKED:
Defined in lib/index.d.ts:78
The Opaque user ID was revoked by the user.
• TRANSFERRED:
Defined in lib/index.d.ts:95
N/A