https://github.com/bezkoder/vue-vuex-jwt-auth
Vue.js Demo for JWT Authentication with Vuex and Vue Router
https://github.com/bezkoder/vue-vuex-jwt-auth
authentication authorization jwt vue vue-auth vue-jwt-authentication vue-router vuejs vuex
Last synced: 3 months ago
JSON representation
Vue.js Demo for JWT Authentication with Vuex and Vue Router
- Host: GitHub
- URL: https://github.com/bezkoder/vue-vuex-jwt-auth
- Owner: bezkoder
- Created: 2020-01-08T15:33:31.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T05:00:55.000Z (almost 3 years ago)
- Last Synced: 2025-05-19T17:12:15.703Z (7 months ago)
- Topics: authentication, authorization, jwt, vue, vue-auth, vue-jwt-authentication, vue-router, vuejs, vuex
- Language: Vue
- Homepage:
- Size: 741 KB
- Stars: 252
- Watchers: 8
- Forks: 120
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vue.js JWT Authentication with Vuex and Vue Router
For instruction, please visit:
> [Vue 2 JWT Authentication with Vuex and Vue Router](https://bezkoder.com/jwt-vue-vuex-authentication/)
> [Using Typescript](https://bezkoder.com/vuex-typescript-jwt-auth/)
> [Vue 3 JWT Authentication with Vuex and Vue Router](https://bezkoder.com/vue-3-authentication-jwt/)
More Practice:
> [Vue.js CRUD App with Vue Router & Axios](https://bezkoder.com/vue-js-crud-app/)
> [Vue Pagination with Axios and API example](https://bezkoder.com/vue-pagination-axios/)
> [Vue File Upload example using Axios](https://bezkoder.com/vue-axios-file-upload/)
Fullstack with Spring Boot Back-end:
> [Spring Boot + Vue.js: Authentication with JWT & Spring Security Example](https://bezkoder.com/spring-boot-vue-js-authentication-jwt-spring-security/)
Fullstack with Node.js Express Back-end:
> [Node.js Express + Vue.js: JWT Authentication & Authorization example](https://bezkoder.com/node-express-vue-jwt-auth/)
Fullstack CRUD:
> [Vue.js + Node.js + Express + MySQL example](https://bezkoder.com/vue-js-node-js-express-mysql-crud-example/)
> [Vue.js + Node.js + Express + PostgreSQL example](https://bezkoder.com/vue-node-express-postgresql/)
> [Vue.js + Node.js + Express + MongoDB example](https://bezkoder.com/vue-node-express-mongodb-mevn-crud/)
> [Vue.js + Spring Boot + MySQL/PostgreSQL example](https://bezkoder.com/spring-boot-vue-js-crud-example/)
> [Vue.js + Spring Boot + MongoDB example](https://bezkoder.com/spring-boot-vue-mongodb/)
> [Vue.js + Django example](https://bezkoder.com/django-vue-js-rest-framework/)
Integration (run back-end & front-end on same server/port)
> [Integrate Vue.js with Spring Boot](https://bezkoder.com/integrate-vue-spring-boot/)
> [Integrate Vue App with Node.js Express](https://bezkoder.com/serve-vue-app-express/)
## Note:
Open `src/services/auth-header.js` and modify `return` statement for appropriate back-end.
```js
export default function authHeader() {
let user = JSON.parse(localStorage.getItem('user'));
if (user && user.accessToken) {
return { Authorization: 'Bearer ' + user.accessToken }; // for Spring Boot back-end
// return { 'x-access-token': user.accessToken }; // for Node.js Express back-end
} else {
return {};
}
}
```
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Run your tests
```
npm run test
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).