barlog-m / spring-react-oauth2-jwt

26 stars 5 forks source link

SPA Secured with OAuth2 and JWT

Spring Boot + React

Default credentials: user/password

Reqest token with user and password

http POST "http://localhost:8081/oauth/token?grant_type=password&client_id=test_tool&client_secret=06c8cab86d1fe668c4530a9fff15f7a6e35f1858&username=user&password=password"

Use token

http --json http://localhost:8081/api/v1/foo "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJ1c2VyIiwic2NvcGUiOlsiYXBpIl0sIm5hbWUiOiLQn9C-0LvRjNC30L7QstCw0YLQtdC70YwiLCJleHAiOjE0ODgwODIxNzYsImF1dGhvcml0aWVzIjpbIlVTRVIiXSwianRpIjoiYTU0NWNlNjctN2YzNC00NTJiLWFiNzItMWExNmE1MmE1ZjZjIiwiY2xpZW50X2lkIjoidGVzdF90b29sIn0.G64ZXzgjA5vn7c_CrCqjdP4MM5Bknxp7vOJtKS7epl8"

Reqest app auth

http://localhost:8081/oauth/authorize?response_type=token&client_id=test_tool

Run without build jar (with reloadable resources)

gradle bootRun

Run

gradle run

Create executable jar with dependencies

gradle build