Skip to content

Commit 1bca8df

Browse files
1 parent ee0b779 commit 1bca8df

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/vs/workbench/services/authentication/browser/authenticationService.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,17 @@ export type AuthenticationSessionInfo = { readonly id: string; readonly accessTo
9292
export async function getCurrentAuthenticationSessionInfo(credentialsService: ICredentialsService, productService: IProductService): Promise<AuthenticationSessionInfo | undefined> {
9393
const authenticationSessionValue = await credentialsService.getPassword(`${productService.urlProtocol}.login`, 'account');
9494
if (authenticationSessionValue) {
95-
const authenticationSessionInfo: AuthenticationSessionInfo = JSON.parse(authenticationSessionValue);
96-
if (authenticationSessionInfo
97-
&& isString(authenticationSessionInfo.id)
98-
&& isString(authenticationSessionInfo.accessToken)
99-
&& isString(authenticationSessionInfo.providerId)
100-
) {
101-
return authenticationSessionInfo;
95+
try {
96+
const authenticationSessionInfo: AuthenticationSessionInfo = JSON.parse(authenticationSessionValue);
97+
if (authenticationSessionInfo
98+
&& isString(authenticationSessionInfo.id)
99+
&& isString(authenticationSessionInfo.accessToken)
100+
&& isString(authenticationSessionInfo.providerId)
101+
) {
102+
return authenticationSessionInfo;
103+
}
104+
} catch (e) {
105+
// ignore as this is a best effort operation.
102106
}
103107
}
104108
return undefined;

0 commit comments

Comments
 (0)