Made id_token optional in ITokenResponse

According to:
https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#successful-response-1
This commit is contained in:
olegoid 2020-10-01 13:34:26 -04:00 committed by Christof Marti
parent c98463a24c
commit f19ccd13c2

View file

@ -68,7 +68,7 @@ export interface ITokenResponse {
refresh_token: string;
scope: string;
token_type: string;
id_token: string;
id_token?: string;
}
function parseQuery(uri: vscode.Uri) {
@ -454,9 +454,13 @@ export class AzureActiveDirectoryService {
try {
claims = this.getTokenClaims(json.access_token);
} catch {
Logger.info('Failed to fetch token claims from access_token. Attempting to parse id_token instead');
claims = this.getTokenClaims(json.id_token);
} catch (e) {
if (json.id_token) {
Logger.info('Failed to fetch token claims from access_token. Attempting to parse id_token instead');
claims = this.getTokenClaims(json.id_token);
} else {
throw e;
}
}
return {