Sample OAuth2 app with PKCE.
oauth2-sample-app/
├── README.md # This file.
├── authserver/ # Auth Server.
│ ├── build.gradle.kts
│ ├── settings.gradle.kts
│ ├── gradle/
│ ├── gradlew
│ ├── gradlew.bat
│ └── src/
│ ├── main/
│ │ ├── kotlin/
│ │ └── resources/
│ │ └── application.yml # Auth Server Settings.
│ └── test/
├── backend/ # Sample Backend.
│ ├── build.gradle
│ ├── gradle/
│ ├── gradlew
│ ├── gradlew.bat
│ ├── settings.gradle
│ └── src/
│ ├── main/
│ │ ├── kotlin/
│ │ │ └── com/example/backend/
│ │ │ ├── BackendApplication.kt
│ │ │ ├── HelloController.kt # /api/hello endpoint.
│ │ │ └── WebSecurityConfig.kt
│ │ └── resources/
│ │ └── application.yml # Backend Settings.
│ └── test/
└── frontend/ # Sample Frontend.
├── README.md
├── eslint.config.js
├── index.html
├── package-lock.json
├── package.json
├── public/
├── src/
│ ├── App.jsx # Main screen.
│ ├── authConfig.js # Auth Settings.
│ └── main.jsx
└── vite.config.js
# Start Auth server.
$ cd ./authserver/
$ ./gradlew bootRun
...
$ cd ./backend/
$ ./gradlew bootRun
...
$ cd ./frontend/
$ npm ci
$ npm run dev- https://www.baeldung.com/spring-security-oauth-auth-server
- https://www.baeldung.com/spring-security-oauth-resource-server
- https://www.baeldung.com/spring-security-pkce-secret-clients
- https://www.baeldung.com/spring-authentication-single-page-application-pkce
- https://docs.spring.io/spring-authorization-server/reference/guides/how-to-pkce.html