ConstReadonlyINVALID_CREDENTIALS: "INVALID_CREDENTIALS"Stored credentials are invalid or corrupted
ReadonlyNO_CREDENTIALS: "NO_CREDENTIALS"No credentials are stored - user needs to log in
ReadonlyNO_REFRESH_TOKEN: "NO_REFRESH_TOKEN"Refresh token is not available - ensure offline_access scope was requested
ReadonlyRENEW_FAILED: "RENEW_FAILED"Failed to refresh credentials using refresh token
ReadonlySTORE_FAILED: "STORE_FAILED"Failed to store credentials securely
ReadonlyREVOKE_FAILED: "REVOKE_FAILED"Failed to revoke refresh token
ReadonlyLARGE_MIN_TTL: "LARGE_MIN_TTL"Requested minimum TTL exceeds token lifetime
ReadonlyCREDENTIAL_MANAGER_ERROR: "CREDENTIAL_MANAGER_ERROR"Generic credentials manager error
ReadonlyBIOMETRICS_FAILED: "BIOMETRICS_FAILED"Biometric authentication failed
ReadonlyNO_NETWORK: "NO_NETWORK"Network connectivity issue
ReadonlyAPI_ERROR: "API_ERROR"Generic API error
ReadonlyAPI_EXCHANGE_FAILED: "API_EXCHANGE_FAILED"Failed to exchange refresh token for API-specific credentials (MRRT)
ReadonlyINCOMPATIBLE_DEVICE: "INCOMPATIBLE_DEVICE"Device is incompatible with secure storage requirements
ReadonlyCRYPTO_EXCEPTION: "CRYPTO_EXCEPTION"Cryptographic operation failed
ReadonlyUNKNOWN_ERROR: "UNKNOWN_ERROR"Unknown or uncategorized error
import { CredentialsManagerError, CredentialsManagerErrorCodes } from 'react-native-auth0';
try {
const credentials = await auth0.credentialsManager.getCredentials();
} catch (e) {
if (e instanceof CredentialsManagerError) {
switch (e.type) {
case CredentialsManagerErrorCodes.NO_CREDENTIALS:
// User needs to log in
break;
case CredentialsManagerErrorCodes.NO_REFRESH_TOKEN:
// Request offline_access scope during login
break;
case CredentialsManagerErrorCodes.RENEW_FAILED:
// Token refresh failed - may need re-authentication
break;
}
}
}
Platform-agnostic error code constants for Credentials Manager operations.
Use these constants for type-safe error handling when working with credentials operations like getCredentials, saveCredentials, clearCredentials, and getApiCredentials. Each constant corresponds to a specific error type in the CredentialsManagerError.type property.