mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-18 07:41:33 +02:00
fix: Add username to the tokenStoreKey so the saved token is invalidated when the user changes in the environment (#426)
Co-authored-by: Gregory Schier <gschier1990@gmail.com>
This commit is contained in:
co-authored by
Gregory Schier
parent
4f03c5c390
commit
be004425fa
@@ -47,6 +47,7 @@ export interface TokenStoreArgs {
|
||||
clientId: string;
|
||||
accessTokenUrl: string | null;
|
||||
authorizationUrl: string | null;
|
||||
username?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,6 +60,7 @@ function tokenStoreKey(args: TokenStoreArgs) {
|
||||
if (args.clientId) hash.update(args.clientId.trim());
|
||||
if (args.accessTokenUrl) hash.update(args.accessTokenUrl.trim().replace(/^https?:\/\//, ""));
|
||||
if (args.authorizationUrl) hash.update(args.authorizationUrl.trim().replace(/^https?:\/\//, ""));
|
||||
if (args.username) hash.update(args.username);
|
||||
const key = hash.digest("hex");
|
||||
return ["token", key].join("::");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user