React Native Auth0 - v5.5.0
    Preparing search index...

    Class CredentialsManagerError

    Represents an error that occurred during Credentials Manager operations.

    This class wraps authentication errors related to credentials management functionality, including:

    • Storing and retrieving credentials
    • Refreshing expired credentials
    • Multi-Resource Refresh Token (MRRT) / API credentials operations
    • Biometric authentication
    • Token revocation

    The type property provides a normalized, platform-agnostic error code that applications can use for consistent error handling across iOS, Android, and Web.

    • NO_CREDENTIALS: No stored credentials found
    • NO_REFRESH_TOKEN: Refresh token not available (ensure 'offline_access' scope was requested)
    • INVALID_CREDENTIALS: Stored credentials are invalid
    • RENEW_FAILED: Failed to refresh credentials using refresh token
    • STORE_FAILED: Failed to store credentials
    • REVOKE_FAILED: Failed to revoke refresh token
    • LARGE_MIN_TTL: Requested minimum TTL exceeds token lifetime
    • API_EXCHANGE_FAILED: Failed to exchange refresh token for API-specific credentials
    • NO_NETWORK: Network connectivity issue
    • API_ERROR: Generic API error
    • BIOMETRICS_FAILED: Biometric authentication failed
    • INCOMPATIBLE_DEVICE: Device incompatible with secure storage
    • CRYPTO_EXCEPTION: Cryptographic operation failed
    // Using with hooks - getCredentials
    import { useAuth0, CredentialsManagerError } from 'react-native-auth0';

    function MyComponent() {
    const { getCredentials } = useAuth0();

    const fetchCredentials = async () => {
    try {
    const credentials = await getCredentials();
    console.log('Access Token:', credentials.accessToken);
    } catch (error) {
    if (error instanceof CredentialsManagerError) {
    switch (error.type) {
    case 'NO_CREDENTIALS':
    // User needs to log in
    break;
    case 'NO_REFRESH_TOKEN':
    // Refresh token missing - ensure offline_access scope was requested
    break;
    case 'RENEW_FAILED':
    // Token refresh failed - may need to re-authenticate
    break;
    case 'BIOMETRICS_FAILED':
    // Biometric authentication failed
    break;
    }
    }
    }
    };
    }
    // Using with hooks - getApiCredentials (MRRT)
    import { useAuth0, CredentialsManagerError } from 'react-native-auth0';

    function MyComponent() {
    const { getApiCredentials } = useAuth0();

    const fetchApiCredentials = async () => {
    try {
    const apiCredentials = await getApiCredentials(
    'https://api.example.com',
    'read:data write:data'
    );
    console.log('API Access Token:', apiCredentials.accessToken);
    } catch (error) {
    if (error instanceof CredentialsManagerError) {
    switch (error.type) {
    case 'NO_REFRESH_TOKEN':
    // Request offline_access scope on login
    break;
    case 'API_EXCHANGE_FAILED':
    // Check audience and scopes
    break;
    case 'LARGE_MIN_TTL':
    // Reduce minTTL or increase API token expiration
    break;
    }
    }
    }
    };
    }
    // Using with Auth0 class
    import Auth0, { CredentialsManagerError } from 'react-native-auth0';

    const auth0 = new Auth0({
    domain: 'your-domain.auth0.com',
    clientId: 'your-client-id'
    });

    async function manageCredentials() {
    try {
    const credentials = await auth0.credentialsManager.getCredentials();
    console.log('Credentials:', credentials);
    } catch (error) {
    if (error instanceof CredentialsManagerError) {
    console.log('Error type:', error.type);
    console.log('Error message:', error.message);
    }
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Properties

    Constructors

    Methods

    • A static factory method to create an AuthError from a fetch Response object. This is a utility that platform adapters can use for consistency.

      Parameters

      • response: Response

        The fetch Response object.

      • body: any

        The parsed body of the response (can be JSON or text).

      Returns AuthError

      A new AuthError instance.

    Properties

    status: number

    The HTTP status code of the error response, if available.

    code: string

    The error code returned by Auth0 (e.g., 'invalid_grant'), if available.

    json: unknown

    The full JSON response body of the error, if available.

    type: string

    A normalized error type that is consistent across platforms. This can be used for reliable error handling in application code.

    Possible values:

    • INVALID_CREDENTIALS: Stored credentials are invalid
    • NO_CREDENTIALS: No stored credentials found
    • NO_REFRESH_TOKEN: Refresh token is not available
    • RENEW_FAILED: Token renewal failed
    • API_EXCHANGE_FAILED: API credentials exchange failed (MRRT)
    • STORE_FAILED: Failed to store credentials
    • REVOKE_FAILED: Failed to revoke refresh token
    • LARGE_MIN_TTL: Requested minimum TTL exceeds token lifetime
    • BIOMETRICS_FAILED: Biometric authentication failed
    • INCOMPATIBLE_DEVICE: Device incompatible with secure storage
    • CRYPTO_EXCEPTION: Cryptographic operation failed
    • NO_NETWORK: Network error
    • API_ERROR: Generic API error
    • CREDENTIAL_MANAGER_ERROR: Generic credentials manager error
    • UNKNOWN_ERROR: Unknown error type