aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-03-06 23:17:54 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-03-06 23:17:54 +0300
commitb915ce2ba225d1c1209f7499618a67524450739f (patch)
tree72ef63d2e7093af5a86cdbbc587e9843aa414315
parentSaves Username & Scopes On `/` Path (diff)
Set Username Expiry To Permanent
Extends username expiry to a very far date, to prevent it from expiring on session. Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r--src/api/auth.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/auth.ts b/src/api/auth.ts
index 7bdf2bb..f118108 100644
--- a/src/api/auth.ts
+++ b/src/api/auth.ts
@@ -218,7 +218,7 @@ export async function refreshBackendJWT(): Promise<boolean> {
let pass = true;
APIClient.post("/auth/refresh").then((response: AxiosResponse<AuthResult>) => {
- cookies.set(CookieNames.Username, response.data.username, {sameSite: "strict", secure: PRODUCTION, path: "/"});
+ cookies.set(CookieNames.Username, response.data.username, {sameSite: "strict", secure: PRODUCTION, path: "/", expires: new Date(3000, 1)});
const expiry = Date.parse(response.data.expiry);
setTimeout(refreshBackendJWT, (expiry * 0.9));
@@ -250,7 +250,7 @@ export default async function authorize(scopes: OAuthScopes[] = [], disableFunct
if (disableFunction) { disableFunction(true); }
await getDiscordCode(scopes).then(async discord_response =>{
await requestBackendJWT(discord_response.code).then(backend_response => {
- const options: CookieSetOptions = {sameSite: "strict", secure: PRODUCTION, path: "/"};
+ const options: CookieSetOptions = {sameSite: "strict", secure: PRODUCTION, path: "/", expires: new Date(3000, 1)};
cookies.set(CookieNames.Username, backend_response.username, options);
options.maxAge = backend_response.maxAge;