You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**@auth0/auth0-react** is in _Early Access_ in order to get feedback to shape its design. That means:
11
-
12
-
- It is under active development so breaking changes are expected and we will do our best to communicate them.
13
-
- The library is not yet published onto npm.
10
+
**@auth0/auth0-react** is in Beta in order to get feedback to shape its design. As we move towards general availability please be aware that releases may contain breaking changes, but we will do our best to communicate them.
For Early Access, download the binary from the releases page: [auth0-auth0-react-0.3.1.tgz](https://github.com/auth0/auth0-react/releases/download/v0.3.1/auth0-auth0-react-0.3.1.tgz).
29
+
Using [npm](https://npmjs.org/)
30
+
31
+
```bash
32
+
npm install @auth0/auth0-react
33
+
```
29
34
30
-
Then install it from the folder you downloaded it to:
Use the `withAuth0` higher order component to add the `auth0` property to Class components:
102
105
@@ -114,7 +117,7 @@ class Profile extends Component {
114
117
exportdefaultwithAuth0(Profile);
115
118
```
116
119
117
-
### Protecting Routes
120
+
### Protect a Route
118
121
119
122
Protect a route component using the `withAuthenticationRequired` higher order component. Visits to this route when unauthenticated will redirect the user to the login page and back to this page after login:
**Note** If you are using a custom router, you will need to supply the `Auth0Provider` with a custom `onRedirectCallback` method to perform the action that returns the user to the protected page. See examples for [react-router](https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md#1-protecting-a-route-in-a-react-router-dom-app), [Gatsby](https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md#2-protecting-a-route-in-a-gatsby-app) and [Next.js](https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md#3-protecting-a-route-in-a-nextjs-app-in-spa-mode).
For a more detailed example see how to [create a `useApi` hook for accessing protected APIs with an access token](#4-create-a-useapi-hook-for-accessing-protected-apis-with-an-access-token).
0 commit comments