__________________________________________________
This sample demonstrates authentication with Auth0 in an Ionic React application.
Build the sample:
npm run build
The sample needs to be configured with your Auth0 Client ID and Domain.
- Go to Auth0 and click Sign Up.
- Use Google, GitHub, or Microsoft Account to login.
You will need to create a Single Page Application using the Auth0 Dashboard. This will give you a Domain, Client ID, and Client Secret you will need below.
Your project needs to be configured with your Auth0 Domain and Client ID for the authentication flow to work. These values can be retrieved from the settings page of your Auth0 application.
Copy src/auth.config.ts.example
into a new file in the same folder called auth.config.ts
, and replace the values with your Auth0 application credentials:
export const domain = "{DOMAIN}";
export const clientId = "{CLIENT_ID}";
Add the following to your Allowed Callback URLs settings:
com.auth0.samples://{DOMAIN}/capacitor/com.auth0.samples/callback
Add the following to your Allowed Logout URLs settings:
com.auth0.samples://{DOMAIN}/capacitor/com.auth0.samples/callback
If running on a desktop browser, add the following to your Allowed Web Origins settings:
http://localhost:3000
If running on a mobile device, add the following to your Allowed Origins (CORS) settings:
capacitor://localhost
Start the app in local browser:
npm start
Sync assets and run:
# ios
npx cap run ios
# android
npx cap run android