A sample code that shows how to secure springboot-backend and react/typescript-frontend application using auth0.
this is a simplified code from
@auth0-developer-hub
PostgreSQL: latest
JDK: oracle openJDK v19.0.2
Spring Boot: v2.7.12
React: Typescript
Auth0
- Create an Application
To create an application, open the Applications section of Dashboard and click on the Create Application
- Name:
Hello World Client
You can use any name
- Application Type:
Single Page Web Applications
- Name:
- Fill out Application URIs
Click on Settings tab of your Application page, and scroll until you see Application URIs
- Allowed Callback URLs:
http://localhost:4040/callback
- Allowed Logout URLs:
http://localhost:4040
- Allowed Web Origins:
http://localhost:4040
- Allowed Callback URLs:
- click the Save Changes
- Create API
To create API, open the APIs section of Dashboard and Click on the Create API
- Name:
Name: Hello World Server
you can use any name
- Identifier:
https://hello-world.example.com
you can use any logical identifier
- Name:
- edit .env file
- AUTH0-DOMAIN: go to
Applications > Applications > your application > Domain
- AUTH0-AUDIENCE: go to
Applications > APIs > your server > Identifier
- AUTH0-DOMAIN: go to
- edit application.properties
set Name of Database and Postgres password
- install node.js on your local machine
- In the frontend directory, run this code on terminal to install package.json:
npm install
npm start
- edit .env file
- AUTH0-DOMAIN: go to
Applications > Applications > your application > Domain
- AUTH0-CLIENT-ID: go to
Applications > Applications > your application > Client ID
- AUTH0-AUDIENCE: go to
Applications > APIs > your server > Identifier
- AUTH0-DOMAIN: go to
more info: auth0 developers documantation