Fix "no amr found" error in bwdc cli (#589)

* Fix amr error when authing with org api key

* Fix linting

* Return null instead of error if no amr

* Return false instead of null
This commit is contained in:
Thomas Rittson 2022-01-11 13:22:52 +10:00 committed by GitHub
parent 4074c2a45f
commit 2341b1907a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -209,11 +209,8 @@ export class TokenService implements TokenServiceAbstraction {
async getIsExternal(): Promise<boolean> {
const decoded = await this.decodeToken();
if (!Array.isArray(decoded.amr)) {
throw new Error("No amr found");
}
return decoded.amr.includes("external");
return Array.isArray(decoded.amr) && decoded.amr.includes("external");
}
private async skipTokenStorage(): Promise<boolean> {