https://github.com/bezkoder/vue-axios-refresh-token
Vue Refresh Token with Axios Interceptors and JWT example - Vuex, Vue Router
https://github.com/bezkoder/vue-axios-refresh-token
authentication authorization axios jwt jwt-auth jwt-authentication refresh-token token-based-authentication vue vuejs vuejs2 vuex
Last synced: 4 months ago
JSON representation
Vue Refresh Token with Axios Interceptors and JWT example - Vuex, Vue Router
- Host: GitHub
- URL: https://github.com/bezkoder/vue-axios-refresh-token
- Owner: bezkoder
- Created: 2021-07-29T03:22:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-29T03:23:47.000Z (over 4 years ago)
- Last Synced: 2025-03-28T10:47:34.563Z (11 months ago)
- Topics: authentication, authorization, axios, jwt, jwt-auth, jwt-authentication, refresh-token, token-based-authentication, vue, vuejs, vuejs2, vuex
- Language: Vue
- Homepage:
- Size: 166 KB
- Stars: 28
- Watchers: 2
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vue Refresh Token with Axios and JWT example

For instruction, please visit:
> [Vue Refresh Token with Axios and JWT example](https://www.bezkoder.com/vue-refresh-token/)
> [Vue 2 JWT Authentication with Vuex and Vue Router](https://bezkoder.com/jwt-vue-vuex-authentication/)
## Note:
Open `src/services/setupInterceptors.js` and modify `config.headers` for appropriate back-end (found in the tutorial).
```js
instance.interceptors.request.use(
(config) => {
const token = TokenService.getLocalAccessToken();
if (token) {
// config.headers["Authorization"] = 'Bearer ' + token; // for Spring Boot back-end
config.headers["x-access-token"] = token; // for Node.js Express back-end
}
return config;
},
(error) => {
return Promise.reject(error);
}
);
```
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
## Related Posts
> [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/)