From 1d1d1bc85a421ce0fefb6a673d848d7ad84279bd Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 16 Nov 2023 15:47:10 -0600 Subject: [PATCH] fix: allow either access token --- src/commands/org/login/access-token.ts | 3 ++- test/commands/org/login/access-token.nut.ts | 2 +- test/commands/org/login/access-token.test.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/org/login/access-token.ts b/src/commands/org/login/access-token.ts index b616756e..37342e36 100644 --- a/src/commands/org/login/access-token.ts +++ b/src/commands/org/login/access-token.ts @@ -116,7 +116,8 @@ export default class LoginAccessToken extends AuthBaseCommand { } private async getAccessToken(): Promise { - const accessToken = env.getString('SFDX_ACCESS_TOKEN') ?? (await this.askForAccessToken()); + const accessToken = + env.getString('SF_ACCESS_TOKEN') ?? env.getString('SFDX_ACCESS_TOKEN') ?? (await this.askForAccessToken()); if (!matchesAccessToken(accessToken)) { throw new SfError(messages.getMessage('invalidAccessTokenFormat', [ACCESS_TOKEN_FORMAT])); diff --git a/test/commands/org/login/access-token.nut.ts b/test/commands/org/login/access-token.nut.ts index 4c765b29..0c4cbd69 100644 --- a/test/commands/org/login/access-token.nut.ts +++ b/test/commands/org/login/access-token.nut.ts @@ -34,7 +34,7 @@ describe('org:login:access-token NUTs', () => { } ); accessToken = res.jsonOutput?.result.accessToken as string; - env.setString('SFDX_ACCESS_TOKEN', accessToken); + env.setString('SF_ACCESS_TOKEN', accessToken); execCmd(`auth:logout -p -o ${username}`, { ensureExitCode: 0 }); }); diff --git a/test/commands/org/login/access-token.test.ts b/test/commands/org/login/access-token.test.ts index 3f3836f5..91923437 100644 --- a/test/commands/org/login/access-token.test.ts +++ b/test/commands/org/login/access-token.test.ts @@ -112,7 +112,7 @@ describe('org:login:access-token', () => { // prompt once; one for access token expect(result).to.deep.equal(authFields); }); - it('should use env var SFDX_ACCESS_TOKEN as input to the store command', async () => { + it('should use env var SF_ACCESS_TOKEN as input to the store command', async () => { const store = await createNewStoreCommand( ['--instance-url', 'https://foo.bar.org.salesforce.com'], accessToken,