Skip to content

Commit 3014b80

Browse files
use id
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent 8cccb2b commit 3014b80

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • code/extensions/che-github-authentication/src

code/extensions/che-github-authentication/src/github.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,21 @@ export class GitHubAuthProvider implements vscode.AuthenticationProvider {
4747

4848
private deviceAuthentication?: DeviceAuthentication;
4949

50+
private readonly storageKey: string;
51+
5052
constructor(
5153
@inject(Logger) private logger: Logger,
5254
@inject(ErrorHandler) private errorHandler: ErrorHandler,
5355
@inject(ExtensionContext) private extensionContext: ExtensionContext,
5456
@inject(Symbol.for('GithubServiceInstance')) private githubService: GithubService
5557
) {
58+
const workspaceId = process.env.DEVWORKSPACE_ID || 'default';
59+
this.storageKey = `sessions:${workspaceId}`;
5660
this.sessionsPromise = this.readSessions();
5761
}
5862

5963
private async readSessions(): Promise<vscode.AuthenticationSession[]> {
60-
const raw = await this.extensionContext.getContext().secrets.get('sessions');
64+
const raw = await this.extensionContext.getContext().secrets.get(this.storageKey);
6165
if (raw) {
6266
try {
6367
return JSON.parse(raw);
@@ -288,7 +292,7 @@ export class GitHubAuthProvider implements vscode.AuthenticationProvider {
288292

289293
private async storeSessions(sessions: vscode.AuthenticationSession[]): Promise<void> {
290294
this.sessionsPromise = Promise.resolve(sessions);
291-
await this.extensionContext.getContext().secrets.store('sessions', JSON.stringify(sessions));
295+
await this.extensionContext.getContext().secrets.store(this.storageKey, JSON.stringify(sessions));
292296
}
293297

294298
async removeSession(id: string) {

0 commit comments

Comments
 (0)