diff --git a/.version b/.version index e6611d6a..b5da024f 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -v5.0.0-beta.3 +v5.0.0-beta.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f943c47..32416b02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Change Log +## [v5.0.0-beta.4](https://github.com/auth0/react-native-auth0/tree/v5.0.0-beta.4) (2025-07-21) + +[Full Changelog](https://github.com/auth0/react-native-auth0/compare/v5.0.0-beta.3...v5.0.0-beta.4) + +**💡 Major Refactor**: Version 5.0 features a complete architectural overhaul for improved performance, maintainability, and multi-platform extensibility. Check the [Migration Guide](https://github.com/auth0/react-native-auth0/blob/master/MIGRATION_GUIDE.md) for detailed upgrade instructions. + +**⚠️ BREAKING CHANGES** + +- feat: architectural refactor for multi-platform extensibility [\#1233](https://github.com/auth0/react-native-auth0/pull/1233) ([subhankarmaiti](https://github.com/subhankarmaiti)) + +**Added** + +- Fix Documentation Typo: 'retreive' → 'retrieve' [\#1183](https://github.com/auth0/react-native-auth0/pull/1183) ([tinchomengo](https://github.com/tinchomengo)) +- feat: added react native web support [\#1233](https://github.com/auth0/react-native-auth0/pull/1233) ([subhankarmaiti](https://github.com/subhankarmaiti)) + +**Changed** + +- feat(deps): Upgrade React Native to 0.80.1 [\#1237](https://github.com/auth0/react-native-auth0/pull/1237) ([subhankarmaiti](https://github.com/subhankarmaiti)) + +**Fixed** + +- fix(iOS): Fix ephemeralSession parameter type conversion in webAuth [\#1238](https://github.com/auth0/react-native-auth0/pull/1238) ([subhankarmaiti](https://github.com/subhankarmaiti)) + +**Security** + +- chore: pin prettier-related packages to prevent malicious package installation [\#1241](https://github.com/auth0/react-native-auth0/pull/1241) ([subhankarmaiti](https://github.com/subhankarmaiti)) + ## [v5.0.0-beta.3](https://github.com/auth0/react-native-auth0/tree/v5.0.0-beta.3) (2025-06-23) [Full Changelog](https://github.com/auth0/react-native-auth0/compare/v5.0.0-beta.2...v5.0.0-beta.3) diff --git a/FAQ.md b/FAQ.md index 3434dce4..bea4bb7f 100644 --- a/FAQ.md +++ b/FAQ.md @@ -9,6 +9,8 @@ 7. [Auth0 web browser gets killed when going to the background on Android](#7-auth0-web-browser-gets-killed-when-going-to-the-background-on-android) 8. [How to resolve the _Failed to start this transaction, as there is an active transaction at the moment_ error?](#8-how-to-resolve-the-failed-to-start-this-transaction-as-there-is-an-active-transaction-at-the-moment-error) 9. [How can I prevent the autogenerated redirect_uri from breaking if the applicationId has mixed cases or special characters in it on Android?](#9-how-can-i-prevent-the-autogenerated-redirect_uri-from-breaking-if-the-applicationId-has-mixed-cases-or-special-characters-in-it-on-android) +10. [Why doesn't `await authorize()` work on the web? How do I handle login?](#10-why-doesnt-await-authorize-work-on-the-web-how-do-i-handle-login) +11. [Why do my users get logged out frequently? How do I keep them logged in?](#11-why-do-my-users-get-logged-out-frequently-how-do-i-keep-them-logged-in) ## 1. How can I have separate Auth0 domains for each environment on Android? @@ -262,3 +264,76 @@ If you don't need SSO, consider using `ephemeral sessions` or `SFSafariViewContr ## 9. How can I prevent the autogenerated redirect_uri from breaking if the applicationId has mixed cases or special characters in it on Android ? It is recommended to have your applicationId in lower case without special characters to prevent any mismatch with the generated redirect_uri. But in the scenario where you require your applicationId to be of mixed case, to avoid any mismatch , the user can pass a `redirectUri` which matches the one provided in the manage dashboard as part of the `AgentLoginOptions` property. + +## 10. Why doesn't `await authorize()` work on the web? How do I handle login? + +This is a key difference between native and web platforms. + +- **On Native (iOS/Android):** `authorize()` opens an in-app browser overlay. Your app continues running in the background. When the user authenticates, the browser dismisses and the `authorize()` promise resolves with the credentials. `await` works as expected. + +- **On Web:** `authorize()` triggers a **full-page browser redirect** to the Auth0 Universal Login page. Your application's current state is lost. After authentication, the user is redirected back to your app, which causes your entire React application to reload and re-initialize from scratch. Because of this, the original `authorize()` promise is never able to resolve. + +**The Solution: Use the `useAuth0` Hook** + +The recommended way to handle this is by using the `Auth0Provider` and `useAuth0` hook. They are designed to manage this flow automatically: + +1. **On initial load:** The provider checks if the user is returning from a login redirect. If so, it processes the credentials in the URL and establishes a session. +2. **State Management:** The `user` and `isLoading` properties from the `useAuth0` hook will automatically update to reflect the authenticated state after the redirect is handled. + +Your UI should be reactive to the `user` and `isLoading` state, rather than trying to `await` the result of `authorize()`. + +```jsx +import { useAuth0 } from 'react-native-auth0'; + +const MyComponent = () => { + const { authorize, user, isLoading } = useAuth0(); + + // This component will re-render after the redirect, + // and `user` will be populated. + if (isLoading) { + return Loading...; + } + + return ( + + {user ? ( + Welcome, {user.name}! + ) : ( + + + + +
+
Preparing search index...
+
+
+ + + +
+
+
+ +

Class AuthError

+
+
+
+

Represents a generic authentication or API error from Auth0.

+

+ This class provides a structured way to handle errors, with + consistent access to status codes, error codes, and response + bodies. +

+
+
+
+
+

+ Hierarchy (View Summary) +

+ +
+ +
+
+
+ + +
Index
+
+
+
+

Constructors

+ +
+
+

Methods

+ +
+
+

Properties

+ +
+
+
+
+
+
+ + +

Constructors

+
+
+
+ +
    +
  • + +
    +
    +

    Constructs a new AuthError instance.

    +
    +
    +

    Parameters

    +
      +
    • + name: + string +
      +

      + The primary error identifier (e.g., the 'error' + field from an OAuth2 response). +

      +
      +
      +
    • +
    • + message: + string +
      +

      + A human-readable description of the error (e.g., + the 'error_description' field). +

      +
      +
      +
    • +
    • + Optionaldetails: + { + status?: + number; + code?: + string; + json?: + unknown + } +
      +

      + An object containing additional error context. +

      +
      +
      +
    • +
    +
    +

    + Returns + AuthError +

    +
    + +
    +
  • +
+
+
+
+
+ + +

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.

+
+
+ +
+
+
+
+
+ + +
+
+ +
+ + diff --git a/docs/classes/default.html b/docs/classes/default.html index 352a229f..95eef7c9 100644 --- a/docs/classes/default.html +++ b/docs/classes/default.html @@ -3,8 +3,8 @@ - default | react-native-auth0 - + default | React Native Auth0 - v5.0.0-beta.4 + @@ -33,8 +33,14 @@
-

Auth0 for React Native client

+

The main Auth0 client class.

+

+ This class acts as a facade, creating and delegating to a + platform-specific client instance (Native or Web) under the hood. +

+
+
+
+ +
import Auth0 from 'react-native-auth0';

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