Skip to content

Commit 1aa0ecd

Browse files
committed
on logout revoke access and refresh tokens
1 parent cf384cb commit 1aa0ecd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

frontend/src/auth/logOut.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/* eslint-disable import/prefer-default-export */
2+
import Axios from 'axios';
23

34
export const logOut = async () => {
5+
await Axios.delete('/auth/access_revoke');
6+
await Axios.delete('/auth/refresh_revoke');
47
localStorage.removeItem(process.env.VUE_APP_ACCESS_TOKEN);
58
localStorage.removeItem(process.env.VUE_APP_REFRESH_TOKEN);
69
localStorage.removeItem(process.env.VUE_APP_VUEX_PERSISTED_STATE);

frontend/src/plugins/http.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import { getAccessToken, getRefreshToken, handleAccessTokenExpiration } from '..
99
Axios.defaults.baseURL = process.env.VUE_APP_BACKEND_BASE_URL;
1010

1111
Axios.interceptors.request.use(async function (config) {
12-
if (config.url === '/auth/refresh') {
12+
if (config.url === '/auth/refresh' || config.url === '/auth/refresh_revoke') {
1313
config.headers.Authorization = `Bearer ${getRefreshToken()}`;
14+
} else if (config.url === '/auth/access_revoke') {
15+
config.headers.Authorization = `Bearer ${getAccessToken()}`;
1416
} else if (getAccessToken()) {
1517
await handleAccessTokenExpiration();
1618
if (getAccessToken()) {

0 commit comments

Comments
 (0)