Skip to content

Commit

Permalink
fix: add falcon sandboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
amphro committed Oct 7, 2020
1 parent 7598687 commit 558dd72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/authInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ function getJwtAudienceUrl(options: OAuth2Options) {
} else if (isInternalUrl(loginUrl)) {
// This is for internal developers when just doing authorize;
audienceUrl = loginUrl;
} else if (createdOrgInstance.startsWith('cs') || urlParse(loginUrl).hostname === 'test.salesforce.com') {
} else if (
createdOrgInstance.startsWith('cs') ||
createdOrgInstance.endsWith('s') ||
urlParse(loginUrl).hostname === 'test.salesforce.com'
) {
audienceUrl = SfdcUrl.SANDBOX;
} else if (createdOrgInstance.startsWith('gs1')) {
audienceUrl = 'https://gs1.salesforce.com';
Expand Down
8 changes: 8 additions & 0 deletions test/unit/authInfoTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,14 @@ describe('AuthInfo', () => {
await runTest({ createdOrgInstance: 'cs17' }, 'https://test.salesforce.com');
});

it('should use the correct audience URL for createdOrgInstance ending with "s"', async () => {
await runTest({ createdOrgInstance: 'usa2s' }, 'https://test.salesforce.com');
});

it('should use the correct audience URL for createdOrgInstance capitalized and ending with "s"', async () => {
await runTest({ createdOrgInstance: 'IND2S' }, 'https://test.salesforce.com');
});

it('should use the correct audience URL for createdOrgInstance beginning with "gs1"', async () => {
await runTest({ createdOrgInstance: 'gs1' }, 'https://gs1.salesforce.com');
});
Expand Down

0 comments on commit 558dd72

Please sign in to comment.