Skip to content

Latest commit

 

History

History
630 lines (436 loc) · 32.4 KB

MIGRATION_GUIDE.md

File metadata and controls

630 lines (436 loc) · 32.4 KB

Migration Guide

Upgrading from v5 -> v6

Version 6.0 of react-native-auth0 modernizes the SDK's foundation and delegates all authentication to the underlying native SDKs (Auth0.swift and Auth0.Android). This guide is being written incrementally as the v6 workstreams land; each section below is marked with its status.

Status legend: ✅ Landed · 🚧 In progress · ⏳ Planned

Upgrading from v5.x requires addressing several breaking changes. Please follow this guide carefully.

1. Compatibility & Installation

Before updating the library, ensure your project meets the new minimum requirements.

Environment Requirements

Requirement v5.x v6.0
React 19.0.0+ 19.0.0+
React Native 0.78.0+ 0.82.0+ (New Arch only)
Architecture Old or New New Architecture only
Expo SDK 53+ SDK 55+ (see below)
iOS Deployment 14 Deployment 15.1 (see §4)
Android Target SDK 35 Target SDK 36, minSdk 26, JDK 17 (see §3)

2. React Native New Architecture is now required ✅

This is the foundational breaking change in v6. React Native 0.82 is the first React Native release that runs entirely on the New Architecture — the Legacy Architecture is no longer part of how apps run, and future releases will remove the remaining Legacy Architecture code from the codebase. To match the ecosystem, v6 of this SDK drops old-architecture support entirely and ships as a TurboModule-only native module.

What changed internally (no consumer code change, but affects your build):

  • The Android module no longer ships an old-architecture (oldarch) bridge spec; it is now TurboModule-only.
  • The iOS module no longer compiles the legacy RCTBridgeModule path; it standardizes on the codegen TurboModule.
  • The react-native peer dependency floor is now >=0.82.0.

✅ Action Required:

  1. Upgrade React Native to 0.82.0 or higher.

    npm install react-native@^0.82.0 react@^19.0.0

    Follow the React Native 0.82 release notes for the full upgrade steps, including removing any legacy old-architecture opt-outs.

  2. If you cannot enable the New Architecture yet, stay on react-native-auth0@5.x until your app is migrated. v6 will not run on the legacy bridge.

Note for web (react-native-web) consumers: the web platform is unaffected by this change — it uses @auth0/auth0-spa-js and has no native module. No action is required for web-only usage.

For Expo Projects

Expo SDK 55+ uses the New Architecture only. Use Expo SDK 55 or higher.

npx expo prebuild --clean

Warning: prebuild --clean overwrites manual changes in your ios and android directories.

3. Android: minSdk 26 & JDK 17 ✅

v6 adopts Auth0.Android 4.2.1, which raises the SDK's build floors. These are inherited by your app.

Setting v5.x v6.0
minSdk 21 26
compileSdk 35 36
JDK 11 17
Kotlin 1.9 2.0.21
AGP 8.x 8.10.1+

The library itself now builds with targetSdk 36. That does not change your app's targetSdkVersion; keep the value you already target.

✅ Action Required:

  1. Raise minSdkVersion to 26 in your app's android/build.gradle. Devices below Android 8.0 (Oreo) are no longer supported.
  2. Build with JDK 17. Verify with java -version, and set org.gradle.java.home in gradle.properties if you have multiple JDKs installed.
  3. Ensure your Android Gradle Plugin is 8.10.1 or higher.

4. iOS: Auth0.swift 3.0 ✅

v6 adopts Auth0.swift 3.2.0, which is built with the Swift 6 compiler.

✅ Action Required:

  1. Your iOS deployment target must meet React Native 0.82's floor (min_ios_version_supported, currently 15.1). The podspec inherits this value, so no explicit platform :ios bump is needed beyond what RN 0.82 already requires.
  2. Run pod install --repo-update in your ios directory to pick up Auth0.swift 3.2.0.
  3. Use Xcode 16 or later.

See §9 for the public-API changes that come with these native majors.

5. DPoP is now opt-in ✅

useDPoP now defaults to false. In v5.1.0–v5.x it defaulted to true, which meant every app got DPoP-bound tokens whether or not DPoP was enabled for the application in the Auth0 Dashboard. Since DPoP has to be turned on tenant-side to be useful, it is now something you opt into explicitly.

✅ Action Required: if you rely on DPoP, set it explicitly:

  const auth0 = new Auth0({
    domain: 'YOUR_AUTH0_DOMAIN',
    clientId: 'YOUR_AUTH0_CLIENT_ID',
+   useDPoP: true,
  });

If you never set useDPoP and don't need DPoP, no change is required — you will simply get Bearer tokens.

Warning — existing sessions: credentials saved by a DPoP-enabled v5 app are DPoP-bound. If you upgrade without setting useDPoP: true, the credentials manager is no longer configured to prove possession of the key, and reading those stored credentials fails with DPOP_NOT_CONFIGURED (CredentialsManagerErrorCodes.DPOP_NOT_CONFIGURED). Either set useDPoP: true to keep those sessions working, or clear the stored credentials and have the user log in again:

try {
  const credentials = await auth0.credentialsManager.getCredentials();
} catch (e) {
  if (e.type === 'DPOP_NOT_CONFIGURED') {
    await auth0.credentialsManager.clearCredentials();
    // Send the user through authorize() again.
  }
}

6. Behavioral default shifts under native delegation

minTtl now defaults to 60 seconds ✅

minTTL now defaults to 60 seconds on getCredentials() and getApiCredentials(), matching Auth0.Android v4 / Auth0.swift v3 (and auth0-flutter v3). Previously it defaulted to 0, so a token was only refreshed once it had already expired; now it is refreshed when fewer than 60 seconds of lifetime remain. Pass an explicit minTtl to override.

⚠️ Action Required: none for most apps. If you relied on the old 0 default — e.g. you never want a proactive refresh — pass minTtl: 0 explicitly.

Remaining default shifts ⏳

The remaining native-delegation default shifts (e.g. scope gaining offline_access, default connection names) are planned and will be documented here when that workstream merges.

7. Management API (users()) removed ✅

The client-side Management API wrapper is gone. auth0.users(token) — and with it getUser() and patchUser() — has been removed, mirroring Auth0.swift v3 and Auth0.Android v4, which both dropped their Management clients. The IUsersClient type and the GetUserParameters / PatchUserParameters types are no longer exported.

Calling the Management API from a client requires an access token with broad, over-privileged scopes (read:current_user, update:current_user_metadata), which cannot be kept secret in a mobile app or browser. Management operations belong on a server you control.

✅ Action Required: move these calls to a backend-for-frontend (BFF). Your app sends its own access token to your backend; the backend validates it, then calls the Management API with its own credentials.

- const profile = await auth0.users(accessToken).getUser({ id: user.sub });
+ const res = await fetch('https://your-api.example.com/me', {
+   headers: { Authorization: `Bearer ${accessToken}` },
+ });
+ const profile = await res.json();

For updating user_metadata, expose an endpoint on your backend that performs the patch after authorizing the request.

Reading the current user's profile does not need the Management API. auth0.auth.userInfo({ token }) calls /userinfo and works with a normal access token, and the user object from useAuth0() is decoded from the ID token.

8. MFA methods on the auth client removed ✅

The four MFA methods on auth0.auth are gone, replaced by the dedicated auth0.mfa client that also supports listing and enrolling authenticators. They were deprecated in v5.x. The mfa client is available on iOS, Android, and web.

Removed from auth0.auth Use instead on auth0.mfa
loginWithOTP({ mfaToken, otp }) verify({ mfaToken, otp })
loginWithOOB({ mfaToken, oobCode, bindingCode }) verify({ mfaToken, oobCode, bindingCode })
loginWithRecoveryCode({ mfaToken, recoveryCode }) verify({ mfaToken, recoveryCode })
multifactorChallenge({ mfaToken, authenticatorId }) challenge({ mfaToken, authenticatorId })

The equivalents on useAuth0() are removed too: authorizeWithOTP, authorizeWithOOB, authorizeWithRecoveryCode, and sendMultifactorChallenge — use the mfa client from the hook instead. The LoginOtpParameters, LoginOobParameters, LoginRecoveryCodeParameters, MfaChallengeParameters, and MfaChallengeResponse types are no longer exported.

✅ Action Required:

- const credentials = await auth0.auth.loginWithOTP({ mfaToken, otp });
+ const credentials = await auth0.mfa.verify({ mfaToken, otp });

verify() is a superset of the three loginWith* methods — it also accepts scope and audience for the returned credentials.

One behavioural difference. multifactorChallenge() treated authenticatorId as optional, letting Auth0 pick a default factor. On mfa.challenge() it is required. If you relied on omitting it, list the user's authenticators first and pass an explicit id:

const authenticators = await auth0.mfa.getAuthenticators({ mfaToken });

// A user can reach MFA_REQUIRED with nothing enrolled yet — enrol a factor
// with `auth0.mfa.enroll()` before challenging.
if (authenticators.length === 0) {
  return promptEnrollment();
}

const challenge = await auth0.mfa.challenge({
  mfaToken,
  authenticatorId: authenticators[0].id,
});

9. Native SDK API alignment (Auth0.Android v4 / Auth0.swift v3) ✅

Adopting the new native SDK majors changes three parts of the public surface.

ephemeralSession now takes effect on Android

Auth0.Android 4.0 added ephemeral browsing for Custom Tabs, so the ephemeralSession option on authorize() is no longer iOS-only. Previously the option was accepted on Android but silently ignored; it now opens the Custom Tab in an isolated session where cookies, cache and history are discarded when the browser closes.

Requires Chrome 136+ or another browser that supports ephemeral browsing. On unsupported browsers a warning is logged and the flow falls back to a regular Custom Tab, so login still completes but the session is not ephemeral.

⚠️ Action Required: if your Android code passes ephemeralSession: true — for example because the same options object is shared across platforms — SSO will now be disabled on Android too, and users will be prompted to log in on every authorize() call. Set the flag per platform if you want to keep SSO on Android.

await authorize(
  { scope: 'openid profile email' },
  { ephemeralSession: Platform.OS === 'ios' }
);

Two further Android caveats: the fallback above means you should keep calling clearSession unless you can guarantee the browser honours the ephemeral request, and ephemeral browsing is supported on a standard Custom Tab (the default) and on Auth Tab (opt-in via useAuthTab, see below) but not on a Trusted Web Activity. So with useTrustedWebActivity enabled the session is not ephemeral; on a Custom Tab or Auth Tab it is ephemeral as long as the browser supports it (Chrome 136+). See Ephemeral Sessions for details.

Auth Tab is available as an opt-in Android web authentication launch mode

Auth0.Android 4.0 added an Auth Tab launch path that delivers a real ActivityResult from the Custom Tab instead of inferring cancellation from activity lifecycle events. This addresses a long-standing Android bug (#1584) where tapping Chrome's minimize button (available in Chrome 122+) would incorrectly reject authorize() with USER_CANCELLED while leaving the browser alive as a "zombie" — so when the user returned and completed login, the redirect was dropped and credentials never arrived.

What changed: the SDK adds a new useAuthTab option to authorize() and clearSession(). It defaults to false, so by default Android continues to use the standard Custom Tab launch path and behavior is unchanged from v5. Set useAuthTab: true to opt in to the Auth Tab launch mechanism and pick up the minimize-button fix. The iOS flow is unchanged; web is unaffected.

await authorize({}, { useAuthTab: true }); // launch login via Auth Tab
await clearSession({}, { useAuthTab: true }); // launch logout via Auth Tab

Browser support: Auth Tab requires Chrome 137 or later. On older browser versions it automatically falls back to a standard Custom Tab, so login and logout still work.

Mutually exclusive with TWA: useAuthTab and useTrustedWebActivity rely on different underlying launch mechanisms and cannot be combined. If both are set, useTrustedWebActivity takes precedence and Auth Tab is not used.

✅ Action Required: None — the default (useAuthTab: false) preserves existing v5 behavior. If your Android users hit the spurious USER_CANCELLED error from Chrome's minimize button, opt in with useAuthTab: true and test across browsers (Edge, Brave, Firefox) — Auth Tab has been validated with Chrome.

Note: With Auth Tab enabled, real user cancellation (back button, dismiss gesture) still rejects with USER_CANCELLED as expected — only the spurious rejection from the minimize button is fixed.

SSOCredentials.expiresIn is now expiresAt

Both native SDKs replaced the relative TTL with an absolute expiration date. The SDK follows suit, so the field is now an absolute UNIX timestamp in seconds — consistent with Credentials.expiresAt.

✅ Action Required: if you read this field, switch to expiresAt and stop adding it to the current time.

  const ssoCredentials = await auth0.credentialsManager.getSSOCredentials();
- const expiryTime = Date.now() / 1000 + ssoCredentials.expiresIn;
+ const expiryTime = ssoCredentials.expiresAt;

Removed and added WebAuthErrorCodes

Auth0.swift 3.0 removed the underlying error cases behind three codes, so they can no longer be raised and have been removed:

Removed code Notes
NO_BUNDLE_IDENTIFIER No longer reported by Auth0.swift.
NO_AUTHORIZATION_CODE Now surfaces as CODE_EXCHANGE_FAILED.
INVALID_INVITATION_URL No longer reported by Auth0.swift.

A fourth code, PKCE_NOT_ALLOWED, has not been removed — it is still exported and still raised on Android (a0.pkce_not_available). Only iOS stopped reporting it, so it is now Android-only. Keep any Android handling for it in place.

Two codes were added for the new Auth0.swift cases, both iOS-only: AUTHENTICATION_FAILED and CODE_EXCHANGE_FAILED.

✅ Action Required: remove any switch/if branches on NO_BUNDLE_IDENTIFIER, NO_AUTHORIZATION_CODE, or INVALID_INVITATION_URL. Ensure you have a default branch, as always.

Improvement: on iOS, server-returned errors such as access_denied, invalid_request, and a0.invalid_configuration now map to their specific WebAuthErrorCodes values instead of collapsing into UNKNOWN_ERROR. If you relied on UNKNOWN_ERROR to catch a denied consent, switch to ACCESS_DENIED.

New CredentialsManagerErrorCodes

SSO_EXCHANGE_FAILED (iOS and Android) and CLEAR_FAILED (iOS) are now reported instead of being collapsed into a generic credentials-manager error. No action is required unless you exhaustively match on these codes.

New clearAll() on the credentials manager

The native SDK majors added a clearAll() method that wipes the entire storage backing the credentials manager, not just the keys this SDK writes. The SDK now surfaces it on auth0.credentialsManager.clearAll() and useAuth0().

clearCredentials() is unchanged — it removes the main credentials (and the DPoP key). Use clearAll() when you also want to drop every API credential for all audiences in one call.

// Remove the session credentials only (as before)
await auth0.credentialsManager.clearCredentials();

// Remove everything in the credentials store, including all API credentials
await auth0.credentialsManager.clearAll();

⚠️ Warning: clearAll() delegates to the native SDK, which deletes all entries in the underlying store (the Keychain service on iOS, EncryptedSharedPreferences on Android). If you share that store with non-Auth0 data — for example by passing a custom credentialsManagerStorageKey that collides with your own keys — that data is removed too. Keep the store dedicated to Auth0 credentials, or use clearCredentials() / clearApiCredentials() for targeted removal. On web, where @auth0/auth0-spa-js manages a single cache, clearAll() behaves the same as clearCredentials().

ID-token claim validation is now opt-in on direct token requests

On native, neither Auth0.swift 3.0 nor Auth0.Android 4.0.1 validates the ID token's claims implicitly on the Authentication API's direct token-request methods — validation is opt-in via .validateClaims() and off by default. The only native flow that validates the ID token on its own is Web Authentication (authorize()), whose browser-based flow verifies it internally. On web, @auth0/auth0-spa-js validates as part of its token request for every flow it supports (passwordless is not supported on web — it rejects with UnsupportedOperation). Which flows validate the ID token automatically:

Flow iOS Android Web
Web Authentication (authorize()) ✅ ✅ ✅
Passkey signin ❌ ❌ ✅
Passkey signup ❌ ❌ ✅
Custom Token Exchange ❌ ❌ ✅
MFA challenge/verify ❌ ❌ ✅
Passwordless ❌ ❌ N/A

For any native ❌ cell, validate the ID token yourself (signature, iss, aud, exp, and nonce where applicable) before using its claims for identity or authorization decisions. Auth0User.fromIdToken only decodes the token and checks for sub — it does not validate.

10. Interfaces no longer use the I prefix ✅

The platform contracts in src/core/interfaces/ dropped their I prefix, so the interface now takes the plain name and the implementations keep their platform prefix (Auth0Client is the contract; NativeAuth0Client and WebAuth0Client implement it).

Only one of these was exported to consumers:

- import type { IMfaClient } from 'react-native-auth0';
+ import type { MfaClient } from 'react-native-auth0';

✅ Action Required: rename the import if you annotated anything with IMfaClient — typically a variable holding auth0.mfa or the mfa object from useAuth0(). This is a type-only change; runtime behaviour is identical.

AuthenticationProvider, CredentialsManager, MyAccountClient, PasswordlessClient, and WebAuthProvider are now exported under their plain names too (see §11); only NativeBridge stays internal-only.

11. Public API surface freeze & My Account error normalization ✅

The public surface was audited before v6 GA: previously-unreachable types were exported, dead internal types were un-exported, and MyAccountError was brought in line with the rest of the error taxonomy.

MyAccountError.type is now a normalized code

MyAccountError.type used to be the raw RFC 7807 type URI reported by the My Account API (e.g. https://auth0.com/api-errors/A0E-401-0001). It is now a normalized MyAccountErrorCodes value, consistent with every other error class in the SDK. The original URI is preserved on a new typeUri property.

⚠️ Action Required: if you compared MyAccountError.type against a raw URI string, switch to comparing against MyAccountErrorCodes and read typeUri for the raw value.

- if (error.type === 'https://auth0.com/api-errors/A0E-401-0001') { ... }
+ if (error.type === MyAccountErrorCodes.UNAUTHORIZED) { ... }
+ console.log(error.typeUri); // "https://auth0.com/api-errors/A0E-401-0001" — raw, log this

Four internal types are no longer exported

NativeAuth0Options, WebAuth0Options, NativeCredentialsResponse, and SSOCredentialsResponse were internal adapter-construction/wire shapes that were reachable from react-native-auth0 by accident. They are not part of the supported API and have been removed from the package's exports.

✅ Action Required: if you imported any of these four types directly, inline the shape you need or open an issue describing your use case — none of them were meant to be public.

Recommended Reading

  • The FAQ for guidance on the authorize() redirect flow on web and the importance of the offline_access scope.

Upgrading from v4 -> v5

Version 5.0 of react-native-auth0 is a significant update featuring a complete architectural overhaul. This new foundation improves performance, maintainability, and provides a more consistent API across all platforms.

Upgrading from v4.x requires addressing several breaking changes. Please follow this guide carefully.

1. Compatibility & Installation

Before updating the library, ensure your project meets the new minimum requirements.

Environment Requirements

  • React: 19.0.0 or higher
  • React Native: 0.78.0 or higher
  • Expo: SDK 53 or higher
  • iOS: Deployment Target 14.0
  • Android: Target SDK 35 or higher

Updating Your Project

For Standard React Native Projects:

  1. Upgrade React Native:
    npm install react@^19.0.0 react-native@^0.78.0
  2. Update this Library:
    npm install react-native-auth0
  3. Update iOS Target: In your ios/Podfile, set the platform version:
    platform :ios, '14.0'
  4. Install Pods:
    cd ios && pod install && cd ..

For Expo Projects:

  1. Upgrade Expo SDK:
    npx expo upgrade
  2. Update this Library:
    npm install react-native-auth0
  3. Rebuild Native Code:
    npx expo prebuild --clean

    Warning: This will overwrite any manual changes in your ios and android directories.

2. Breaking API Changes

The following API changes require code modifications in your application.

Change #1: User Profile Properties are now camelCase

To align with modern JavaScript standards, all properties on the user object are now camelCase.

✅ Action Required: Update all references to user properties.

Before (snake_case) After (camelCase)
user.given_name user.givenName
user.family_name user.familyName
user.email_verified user.emailVerified
user.phone_number user.phoneNumber
...and so on.

Change #2: Standardized AuthError Object

All errors thrown by the library are now instances of a single, consistent AuthError class. This replaces multiple error types like CredentialsManagerError.

✅ Action Required: Update your try...catch blocks to handle the new unified error object.

Before:

catch (e) {
  // Inconsistent properties like e.error, e.error_description
  console.error(e.message);
}

After:

import { AuthError } from 'react-native-auth0';

catch (e) {
  if (e instanceof AuthError) {
    // Consistent properties are now available
    console.error(e.name, e.message); // e.g., 'invalid_grant', 'The refresh token is invalid.'
  }
}

Change #3: Platform-Specific API Availability

With the introduction of React Native Web support, some methods are only available on native platforms for security reasons. Direct authentication grants that handle user credentials (like passwords or OTP codes) are not supported in the browser and will throw a NotImplemented error.

✅ Action Required: If you are building for the web, ensure all authentication flows are initiated via the redirect-based authorize() method. Review the platform support table in the README for a full list of platform-specific methods.

Change #4: authorize() Behavior on Web

On React Native Web, the authorize() method now triggers a full-page redirect to Auth0. As a result, the promise returned by authorize() will not resolve in the browser. Your application must be structured to handle the user state upon reloading after the redirect.

✅ Action Required: Review the new FAQ entry for guidance on how to correctly handle the post-login flow on the web. The Auth0Provider and useAuth0 hook are designed to manage this flow automatically.

Change #5: Hook Methods Now Throw Error

Previously, all hook-related methods such as getCredentials(), saveCredentials(), etc., did not throw error directly. Instead, any issues were silently handled and surfaced via the error property in useAuth0():

const { error } = useAuth0();
// error would be populated if getCredentials failed

What's Changed:

These methods now throw error directly to the caller. You must handle them explicitly using try...catch blocks.

✅ Action Required: Update your code to handle error for each function call individually.

Before:

const { getCredentials, error } = useAuth0();
---
await getCredentials();
// Check error manually later

After:

const { getCredentials, error } = useAuth0();

try {
  await getCredentials();
} catch (e) {
  console.error(e);
}

All thrown errors are instances of the new standardized AuthError class described in Change #2.

Recommended Reading

After migrating, we highly recommend reviewing the updated FAQ for detailed explanations on:

  • How to handle the authorize() redirect flow on the web.
  • The importance of the offline_access scope for keeping users logged in.

Upgrading from v3 -> v4

  • If your project is built with Expo:
    • Run npx expo prebuild --clean to ensure the intent-filters in android & custom scheme's in iOS are propertly setup. Please note that any manual changes to Android or iOS folders will be lost when this command is executed.

Breaking Changes:

  • requireLocalAuthentication method is no longer available as part of the CredentialsManager class or the useAuth0 Hook from v4 of the SDK. Refer below sections on how to enable authentication before obtaining credentials now.

Changes:

  • Updated the Auth0 class constructor to accept a new parameter, LocalAuthenticationOptions, for enabling authentication before obtaining credentials as shown below:
const localAuthOptions: LocalAuthenticationOptions = {
    title: 'Authenticate to retreive your credentials',
    subtitle: 'Please authenticate to continue',
    description: 'We need to authenticate you to retrieve your credentials',
    cancelTitle: 'Cancel',
    evaluationPolicy: LocalAuthenticationStrategy.deviceOwnerWithBiometrics,
    fallbackTitle: 'Use Passcode',
    authenticationLevel: LocalAuthenticationLevel.strong,
    deviceCredentialFallback: true,
  }
const auth0 = new Auth0({ domain: config.domain, clientId: config.clientId, localAuthenticationOptions: localAuthOptions });

Modified the Auth0Provider to accept LocalAuthenticationOptions as a parameter to enable authentication before obtaining credentials.

const localAuthOptions: LocalAuthenticationOptions = {
  title: 'Authenticate to retreive your credentials',
  subtitle: 'Please authenticate to continue',
  description: 'We need to authenticate you to retrieve your credentials',
  cancelTitle: 'Cancel',
  evaluationPolicy: LocalAuthenticationStrategy.deviceOwnerWithBiometrics,
  fallbackTitle: 'Use Passcode',
  authenticationLevel: LocalAuthenticationLevel.strong,
  deviceCredentialFallback: true,
};

const App = () => {
  return (
    <Auth0Provider
      domain={config.domain}
      clientId={config.clientId}
      localAuthenticationOptions={localAuthOptions}
    >
      {/* YOUR APP */}
    </Auth0Provider>
  );
};

export default App;

Upgrading from v2 -> v3

Improvements and changes

  • Web Auth will now have default scope of 'openid profile email', so these scopes can be removed if you're explicitly specifying them
  • Minimum supported version for iOS is bumped to 13
  • Minimum supported version for Expo is bumped to 48
  • Revoke Token and Change Password now return void instead of an empty object

Breaking changes

  • The properties inside the user object will now be camelCase instead of snake_case
  • Removed the type property returned in the Credentials object in Android. Use tokenType instead.
  • Credentials object in iOS will return expiresAt instead of expiresIn
  • expiresIn value will now return expiresAt value which is a UNIX timestamp of the expiration time.
  • max_age parameter is changed to maxAge in WebAuth.authorize()
  • skipLegacyListener has been removed in authorize and clearSession
  • customScheme is now part of ClearSessionOptions instead of ClearSessionParameters in clearSession
  • iOS minimum deployment target is now 13. This can be migrated by adding platform :ios '13.0' to the ios/Podfile file
  • Additional or custom parameters to be sent in authorize method should now be sent as additionalParameters. This includes when sending prompt parameter.
  • Error codes are now platform specific. For example - When user cancels authentication, Android error code is a0.session.user_cancelled and iOS error code is USER_CANCELLED

Callback URL migration

We are migrating the callback URL we use for the SDK to below.

Old

iOS: {PRODUCT_BUNDLE_IDENTIFIER}://{DOMAIN}/ios/{PRODUCT_BUNDLE_IDENTIFIER}/callback
Android: {YOUR_APP_PACKAGE_NAME}://{DOMAIN}/android/{YOUR_APP_PACKAGE_NAME}/callback

New

Notice the new .auth0 suffix after the bundle identifier / package name:

iOS: {PRODUCT_BUNDLE_IDENTIFIER}.auth0://{DOMAIN}/ios/{PRODUCT_BUNDLE_IDENTIFIER}/callback
Android: {YOUR_APP_PACKAGE_NAME}.auth0://{DOMAIN}/android/{YOUR_APP_PACKAGE_NAME}/callback

Choose one of the following migration paths depending on your application:

  • If your project is built with Expo:

    • To keep things as it is, no changes are required
    • To migrate to new non-custom scheme flow:
      • Remove custom scheme in app.json and authorize().
      • Run npx expo prebuild --clean (any manual changes to Android or iOS folders will be lost)
      • Add the new callback URL to Auth0 dashboard
  • If your project is built with Non Expo:

    • To keep things as it is, set useLegacyCallbackUrl to true in authorize and clearSession
    • To migrate to new non-custom scheme flow, add the new callback URL to Auth0 dashboard
    • Change the manifest placeholders in your app's build.gradle file (typically at android/app/build.gradle):

    Old

  android {
    defaultConfig {
        manifestPlaceholders = [auth0Domain: "YOUR_AUTH0_DOMAIN", auth0Scheme: "${applicationId}"]
    }
    ...
}

New

Notice the new .auth0 suffix in auth0Scheme:

android {
    defaultConfig {
        manifestPlaceholders = [auth0Domain: "YOUR_AUTH0_DOMAIN", auth0Scheme: "${applicationId}.auth0"]
    }
    ...
}