File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,25 @@ For more detail, please visit:
66Fullstack with Spring Boot Back-end:
77> [ Spring Boot + Vue.js: Authentication with JWT & Spring Security Example] ( https://bezkoder.com/spring-boot-vue-js-authentication-jwt-spring-security/ )
88
9+ Fullstack with Node.js Express Back-end:
10+ > [ Node.js Express + Vue.js: JWT Authentication & Authorization example] ( https://bezkoder.com/node-express-vue-jwt-auth/ )
11+
12+ ## Note:
13+ Open ` src/services/auth-header.js ` and modify ` return ` statement for appropriate back-end.
14+
15+ ``` js
16+ export default function authHeader () {
17+ let user = JSON .parse (localStorage .getItem (' user' ));
18+
19+ if (user && user .accessToken ) {
20+ return { Authorization: ' Bearer ' + user .accessToken }; // for Spring Boot back-end
21+ // return { 'x-access-token': user.accessToken }; // for Node.js Express back-end
22+ } else {
23+ return {};
24+ }
25+ }
26+ ```
27+
928## Project setup
1029```
1130npm install
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ export default function authHeader() {
22 let user = JSON . parse ( localStorage . getItem ( 'user' ) ) ;
33
44 if ( user && user . accessToken ) {
5- return { Authorization : 'Bearer ' + user . accessToken } ;
5+ return { Authorization : 'Bearer ' + user . accessToken } ; // for Spring Boot back-end
6+ // return { 'x-access-token': user.accessToken }; // for Node.js Express back-end
67 } else {
78 return { } ;
89 }
You can’t perform that action at this time.
0 commit comments