Skip to content

Commit 8485cf2

Browse files
authored
Delete bad JWT token after attempting a refresh to avoid 403 on OPTION /refresh_token. (#219)
This was happening when the JWT token expired and we were trying to refresh it. It would result in a redirect to always the main page instead of the page we were on.
1 parent 5fab9c1 commit 8485cf2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

frontend/src/actions/common.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export function handleErrors(reason, originalFunc){
3232
if (reason.status === 401){
3333

3434
const headers = {"Authorization": cookies.get("Authorization")};
35-
V2.OpenAPI.TOKEN = undefined;
36-
cookies.remove("Authorization", { path: "/" });
3735

3836
return (dispatch) => {
3937
return fetch(config.KeycloakRefresh, {method: "GET", headers: headers})
@@ -54,6 +52,9 @@ export function handleErrors(reason, originalFunc){
5452
type: LOGOUT,
5553
receivedAt: Date.now()
5654
});
55+
// Delete bad JWT token
56+
V2.OpenAPI.TOKEN = undefined;
57+
cookies.remove("Authorization", { path: "/" });
5758
});
5859
};
5960
}

0 commit comments

Comments
 (0)