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

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

Awesome Lists containing this project

README

          

# Vue Refresh Token with Axios and JWT example

![vue-refresh-token-axios-jwt-example-flow](vue-refresh-token-axios-jwt-example-flow.png)

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