Skip to content

Commit

Permalink
Support new iss claim value (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimurgos authored Nov 8, 2023
1 parent 75174cc commit 2bb1fb1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/script/src/esi_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ESIClient {
private static readonly BASE_URL = 'https://esi.evetech.net';
private static readonly AUDIENCE = 'EVE Online';
private static readonly ISSUER = 'login.eveonline.com';
private static readonly ISSUER_URL_SCHEMA = 'https://login.eveonline.com';

public static addQueryParam(path: string, paramName: string, paramValue: any): string {
path += path.includes('?') ? '&' : '?';
Expand All @@ -29,7 +30,7 @@ class ESIClient {
const jwtToken: IAccessTokenData = JSON.parse(Utilities.newBlob(Utilities.base64DecodeWebSafe(access_token.split('.')[1])).getDataAsString());
const clientId: string = getScriptProperties_().getProperty('CLIENT_ID')!;

if (jwtToken.iss !== ESIClient.ISSUER) throw 'Access token validation error: invalid issuer';
if (jwtToken.iss !== ESIClient.ISSUER && jwtToken.iss !== ESIClient.ISSUER_URL_SCHEMA) throw 'Access token validation error: invalid issuer';
if (jwtToken.aud[0] !== clientId || jwtToken.aud[1] !== ESIClient.AUDIENCE) throw 'Access token validation error: invalid audience';
if (jwtToken.azp !== clientId) throw 'Access token validation error: invalid authorized party';
return jwtToken;
Expand Down

0 comments on commit 2bb1fb1

Please sign in to comment.