Skip to content

Commit

Permalink
feat: falcon usa support w/o createdOrgInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jan 21, 2021
1 parent 2bca84c commit ec15d37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/authInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ function getJwtAudienceUrl(options: OAuth2Options & { createdOrgInstance?: strin
options.loginUrl?.includes('sandbox.my.salesforce.com') || // enhanced domains >= 230
options.loginUrl?.match(/([Cc][Ss][0-9]+.my.salesforce.com)/g) || // my domains
options.loginUrl?.match(/([Cc][Ss][0-9]+.salesforce.com)/g) || // instance without my domain
options.loginUrl?.match(/((usa)[0-9]+s\..+\.salesforce\.com)/g) || // falcon sandbox ex: usa2s.sfdc-whatever.salesforce.com
(options.loginUrl && urlParse(options.loginUrl).hostname === 'test.salesforce.com')
) {
return SfdcUrl.SANDBOX;
Expand Down
8 changes: 8 additions & 0 deletions test/unit/authInfoTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,14 @@ describe('AuthInfo', () => {
'https://test.salesforce.com'
);
});

it('returns sandbox audience for falcon domains', async () => {
await runTest({ loginUrl: 'https://usa2s.sfdc-yfeipo.salesforce.com/' }, 'https://test.salesforce.com');
});

it('returns prod audience for falcon domains', async () => {
await runTest({ loginUrl: 'https://usa2.sfdc-yfeipo.salesforce.com/' }, 'https://login.salesforce.com');
});
});

describe('getDefaultInstanceUrl', () => {
Expand Down

0 comments on commit ec15d37

Please sign in to comment.