this is demo project for spring boot + vue.js with maven multi module.
- backend : spring boot with OAuth2 server
- frontend : vuejs with client app
app@app:~/springboot-vuejs-auth$ tree ./ -L 2
./
├── backend -> Server code
│ ├── pom.xml
│ ├── src
├── frontend -> Vue.js code
│ ├── src
│ ├── pom.xml
├── lombok.config
├── pom.xml -> Maven parent pom
http://localhost:3000/api/oauth/token
Authorization
- type : Basic Auth
- Username : myApp
- Password : pass
Body
x-www-form-urlencoded
username : user@email.com
password : user
grant_type : password
Request | Response |
/api/home (with no token) | Hello Anonymous! |
/api/home (with token) | Hello {email}! |
/api/me (with no token) | 401 error |
/api/me (with token) | {"email" : "user@email.com", "roles" : ["USER"]} |
- build frontend & running backend
$ git clone https://github.com/zacscoding/springboot-vuejs-auth.git
$ cd springboot-vuejs-auth
$ mvn clean install
$ java -jar backend/target/backend-1.0-SNAPSHOT.jar
OR
$ mvn --projects backend spring-boot:run
and then connect to http://localhost:3000/
- running respectively
$ cd backend
$ mvn spring-boot:run
$ cd frontend
$ npm start
and then connect to http://localhost:8080/
- home (with no sign in)
- home (with sign in)
- me (with sign in)
- me (with no sign in)
=> then redirect to "/login?returnPath=me"