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
Copy file name to clipboardExpand all lines: Sample-01/README.md
+12-13Lines changed: 12 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Auth0 React SDK Sample Application
2
2
3
-
This sample demonstrates the integration of [Auth0 React SDK](https://github.com/auth0/auth0-react) into a React application created using [create-react-app](https://reactjs.org/docs/create-a-new-react-app.html). The sample is a companion to the [Auth0 React SDK Quickstart](https://auth0.com/docs/quickstart/spa/react).
3
+
This sample demonstrates the integration of [Auth0 React SDK](https://github.com/auth0/auth0-react) into a React application created using [Vite](https://reactjs.org/docs/create-a-new-react-app.html). The sample is a companion to the [Auth0 React SDK Quickstart](https://auth0.com/docs/quickstart/spa/react).
4
4
5
5
This sample demonstrates the following use cases:
6
6
@@ -22,27 +22,26 @@ npm install
22
22
23
23
### Create an API
24
24
25
-
For the ["call an API"](https://auth0.com/docs/quickstart/spa/react/02-calling-an-api) page to work, you will need to [create an API](https://auth0.com/docs/apis) using the [management dashboard](https://manage.auth0.com/#/apis). This will give you an API identifier that you can use in the `audience` configuration field below.
25
+
For the ["call an API"](https://auth0.com/docs/quickstart/spa/react/02-calling-an-api) page to work, you will need to [create an API](https://auth0.com/docs/apis) using the [management dashboard](https://manage.auth0.com/#/apis). This will give you an API identifier that you can use as the `AUTH0_AUDIENCE` environment variable below.
26
26
27
-
If you do not wish to use an API or observe the API call working, you should not specify the `audience` value in the next step. Otherwise, you will receive a "Service not found" error when trying to authenticate.
27
+
If you do not wish to use an API or observe the API call working, you should not specify the `AUTH0_AUDIENCE` environment variable in the next step. Otherwise, you will receive a "Service not found" error when trying to authenticate.
28
28
29
29
### Configure credentials
30
30
31
31
The project needs to be configured with your Auth0 domain and client ID in order for the authentication flow to work.
32
32
33
-
To do this, first copy `src/auth_config.json.example` into a new file in the same folder called `src/auth_config.json`, and replace the values with your own Auth0 application credentials, and optionally the base URLs of your application and API:
33
+
To do this, first copy `.env.example` into a new file in the same folder called `.env.local`, and replace the values with your own Auth0 application credentials, and optionally the base URLs of your application and API:
34
34
35
-
```json
36
-
{
37
-
"domain": "{YOUR AUTH0 DOMAIN}",
38
-
"clientId": "{YOUR AUTH0 CLIENT ID}",
39
-
"audience": "{YOUR AUTH0 API_IDENTIFIER}",
40
-
"appOrigin": "{OPTIONAL: THE BASE URL OF YOUR APPLICATION (default: http://localhost:3000)}",
41
-
"apiOrigin": "{OPTIONAL: THE BASE URL OF YOUR API (default: http://localhost:3001)}"
42
-
}
35
+
```bash
36
+
AUTH0_DOMAIN=your-tenant.us.auth0.com
37
+
AUTH0_CLIENT_ID=your-client-id
38
+
# AUTH0_AUDIENCE=your-api-identifier # optional, only needed for the External API feature
39
+
40
+
# APP_BASE_URL=https://your-app.com # optional, defaults work fine for local development
41
+
# API_BASE_URL=https://your-api-server.com # optional, defaults work fine for local development
43
42
```
44
43
45
-
**Note**: Do not specify a value for `audience` here if you do not wish to use the API part of the sample.
44
+
**Note**: Do not specify a value for `AUTH0_AUDIENCE` here if you do not wish to use the API part of the sample.
0 commit comments