Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jerrychong25/vue-vuex-jwt-auth

Vue Vuex JWT Auth
https://github.com/jerrychong25/vue-vuex-jwt-auth

jwt vue vue-jwt-authentication vue2 vuejs vuejs2 vuex

Last synced: about 14 hours ago
JSON representation

Vue Vuex JWT Auth

Awesome Lists containing this project

README

        

# Vue.js JWT Authentication with Vuex and Vue Router

[![GitHub release](https://img.shields.io/github/release/jerrychong25/vue-vuex-jwt-auth.svg)](https://gitHub.com/jerrychong25/vue-vuex-jwt-auth/releases/)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-no-red.svg)](https://github.com/jerrychong25/vue-vuex-jwt-auth/graphs/commit-activity)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fjerrychong25%2Fvue-vuex-jwt-auth&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)

## 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/).