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
Modernize sample app with React 19, Vite, npm and dependency updates (#392)
* upgrade react major version and migrate to vite
* migrate from reactstrap to react-bootstrap
* upgrade nodemon
* update dockerfile
* change build folder to vite default
* use environment variables instead of local config file
* fix circleci error
* address feedback
* update circleci config docker version
Copy file name to clipboardExpand all lines: Sample-01/README.md
+23-24Lines changed: 23 additions & 24 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://vite.dev). 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
@@ -12,37 +12,36 @@ This sample demonstrates the following use cases:
12
12
13
13
## Project setup
14
14
15
-
Use `yarn` to install the project dependencies:
15
+
Use `npm` to install the project dependencies:
16
16
17
17
```bash
18
-
yarn install
18
+
npm install
19
19
```
20
20
21
21
## Configuration
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.
46
45
47
46
## Run the sample
48
47
@@ -51,15 +50,15 @@ To do this, first copy `src/auth_config.json.example` into a new file in the sam
51
50
This compiles and serves the React app and starts the backend API server on port 3001.
52
51
53
52
```bash
54
-
yarn run dev
53
+
npm run dev
55
54
```
56
55
57
56
## Deployment
58
57
59
58
### Compiles and minifies for production
60
59
61
60
```bash
62
-
yarn run build
61
+
npm run build
63
62
```
64
63
65
64
### Docker build
@@ -69,7 +68,7 @@ To build and run the Docker image, run `exec.sh`, or `exec.ps1` on Windows.
69
68
### Run your tests
70
69
71
70
```bash
72
-
yarn runtest
71
+
npmtest
73
72
```
74
73
75
74
## Frequently Asked Questions
@@ -80,12 +79,12 @@ If you're having issues running the sample applications, including issues such a
80
79
81
80
Auth0 helps you to:
82
81
83
-
* Add authentication with [multiple sources](https://auth0.com/docs/identityproviders), either social identity providers such as **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce** (amongst others), or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS, or any SAML Identity Provider**.
84
-
* Add authentication through more traditional **[username/password databases](https://auth0.com/docs/connections/database/custom-db)**.
85
-
* Add support for **[linking different user accounts](https://auth0.com/docs/users/user-account-linking)** with the same user.
86
-
* Support for generating signed [JSON Web Tokens](https://auth0.com/docs/tokens/json-web-tokens) to call your APIs and **flow the user identity** securely.
87
-
* Analytics of how, when, and where users are logging in.
88
-
* Pull data from other sources and add it to the user profile through [JavaScript rules](https://auth0.com/docs/rules).
82
+
- Add authentication with [multiple sources](https://auth0.com/docs/identityproviders), either social identity providers such as **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce** (amongst others), or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS, or any SAML Identity Provider**.
83
+
- Add authentication through more traditional **[username/password databases](https://auth0.com/docs/connections/database/custom-db)**.
84
+
- Add support for **[linking different user accounts](https://auth0.com/docs/users/user-account-linking)** with the same user.
85
+
- Support for generating signed [JSON Web Tokens](https://auth0.com/docs/tokens/json-web-tokens) to call your APIs and **flow the user identity** securely.
86
+
- Analytics of how, when, and where users are logging in.
87
+
- Pull data from other sources and add it to the user profile through [JavaScript rules](https://auth0.com/docs/rules).
0 commit comments