Sample Auth0 Demo Created by Create React App with Typescript
MIT License
React Application created by create-react-app (Typescript) which includes Auth0
This sample demonstrates how to renew access_token
s in a React application with Auth0 using checkSession
. For more information, read reference documentation. The sample uses the create-react-app.
Create a new API in the APIs section and provide an identifier for it.
Clone the repo or download it from the React quickstart page in Auth0's documentation. Install create-react-app and the dependencies for the app.
npm install -g create-react-app
cd react-auth0-typescript
npm install
If you download the sample from the quickstart page, it will come pre-populated with the client ID and domain for your application. If you clone the repo directly from Github, rename the auth0-variables.tsx.example
file to auth0-variables.tsx
and provide the client ID and domain there. This file is located in src/Auth/
.
Allowed Web Origins
in the dashboardIn order to make checkSession
work, you need to add the URL where the authorization request originates from, to the Allowed Web Origins list of your Auth0 client in the Dashboard under your client's Settings.
The development server that comes with create-react-app can be used to serve the application.
npm start
The application will be served at http://localhost:3000
.
If you see an error on renewal saying login_required
, that means you may be using the Auth0 dev keys for whichever social login you're testing. You'll need to add your own keys for this to work.
In order to run the example with docker you need to have docker
installed.
You also need to set the environment variables as explained previously.
Execute in command line sh exec.sh
to run the Docker in Linux, or .\exec.ps1
to run the Docker in Windows.
Auth0 helps you to:
Suman Kunwar
This project is licensed under the MIT license. See the LICENSE file for more info.