OAuth2: remove useless cookie

This commit is contained in:
Timofey Boyko 2023-11-29 16:10:40 +03:00
parent ea9073c4e0
commit 2fdc2d84ff
3 changed files with 10 additions and 4 deletions

View File

@ -139,6 +139,10 @@ export const onOAuthLogin = () => {
method: "post", method: "post",
url: `/oauth2/login`, url: `/oauth2/login`,
data: formData, data: formData,
withRedirect: true,
headers: {
"X-Disable-Redirect": true,
},
}); });
}; };
@ -161,6 +165,9 @@ export const onOAuthSubmit = (
url: `/oauth2/authorize`, url: `/oauth2/authorize`,
data: formData, data: formData,
withRedirect: true, withRedirect: true,
headers: {
"X-Disable-Redirect": true,
},
}); });
}; };
@ -175,6 +182,9 @@ export const onOAuthCancel = (clientId: string, clientState: string) => {
url: `/oauth2/authorize`, url: `/oauth2/authorize`,
data: formData, data: formData,
withRedirect: true, withRedirect: true,
headers: {
"X-Disable-Redirect": true,
},
}); });
}; };

View File

@ -130,7 +130,6 @@ class AxiosClient {
if (error) throw new Error(error); if (error) throw new Error(error);
if (response.headers["x-redirect-uri"] && options.withRedirect) { if (response.headers["x-redirect-uri"] && options.withRedirect) {
deleteCookie("disable_redirect");
return window.location.replace(response.headers["x-redirect-uri"]); return window.location.replace(response.headers["x-redirect-uri"]);
} }

View File

@ -92,7 +92,6 @@ const Consent = ({
let clientState = ""; let clientState = "";
const scope = oauth.client.scopes; const scope = oauth.client.scopes;
setCookie("disable_redirect", true);
setCookie("client_id", clientId); setCookie("client_id", clientId);
await api.oauth.onOAuthLogin(); await api.oauth.onOAuthLogin();
@ -117,8 +116,6 @@ const Consent = ({
setCookie("client_id", clientId); setCookie("client_id", clientId);
setCookie("disable_redirect", true);
await api.oauth.onOAuthLogin(); await api.oauth.onOAuthLogin();
const cookie = document.cookie.split(";"); const cookie = document.cookie.split(";");