From b93ac504d09145dad3d5b5beea4ce1d5a56985cd Mon Sep 17 00:00:00 2001 From: Eric Willhoit Date: Fri, 6 Oct 2023 09:52:12 -0500 Subject: [PATCH] fix: allow padding on id and secret --- src/org/authInfo.ts | 2 +- test/unit/org/authInfoTest.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/org/authInfo.ts b/src/org/authInfo.ts index c9ddca993e..67eaa24dff 100644 --- a/src/org/authInfo.ts +++ b/src/org/authInfo.ts @@ -362,7 +362,7 @@ export class AuthInfo extends AsyncOptionalCreatable { sfdxAuthUrl: string ): Pick { const match = sfdxAuthUrl.match( - /^force:\/\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]*):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/ + /^force:\/\/([a-zA-Z0-9._-]+={0,2}):([a-zA-Z0-9._-]*={0,2}):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/ ); if (!match) { diff --git a/test/unit/org/authInfoTest.ts b/test/unit/org/authInfoTest.ts index da940d85a4..f4a7a6be9e 100644 --- a/test/unit/org/authInfoTest.ts +++ b/test/unit/org/authInfoTest.ts @@ -1669,16 +1669,18 @@ describe('AuthInfo', () => { expect(options.loginUrl).to.equal('https://test.my.salesforce.com'); }); - it('should parse the token that includes = for padding', () => { + it('should parse an id, secret, and token that include = for padding', () => { const options = AuthInfo.parseSfdxAuthUrl( - 'force://PlatformCLI::5Aep861_OKMvio5gy8xCNsXxybPdupY9fVEZyeVOvb4kpOZx5Z1QLB7k7n5flEqEWKcwUQEX1I.O5DCFwjlYU==@test.my.salesforce.com' + 'force://3MVG9SemV5D80oBfPBCgboxuJ9cOMLWNM1DDOZ8zgvJGsz13H3J66coUBCFF3N0zEgLYijlkqeWk4ot_Q2.4o=:438437816653243682==:5Aep861_OKMvio5gy8xCNsXxybPdupY9fVEZyeVOvb4kpOZx5Z1QLB7k7n5flEqEWKcwUQEX1I.O5DCFwjlYU==@test.my.salesforce.com' ); expect(options.refreshToken).to.equal( '5Aep861_OKMvio5gy8xCNsXxybPdupY9fVEZyeVOvb4kpOZx5Z1QLB7k7n5flEqEWKcwUQEX1I.O5DCFwjlYU==' ); - expect(options.clientId).to.equal('PlatformCLI'); - expect(options.clientSecret).to.equal(''); + expect(options.clientId).to.equal( + '3MVG9SemV5D80oBfPBCgboxuJ9cOMLWNM1DDOZ8zgvJGsz13H3J66coUBCFF3N0zEgLYijlkqeWk4ot_Q2.4o=' + ); + expect(options.clientSecret).to.equal('438437816653243682=='); expect(options.loginUrl).to.equal('https://test.my.salesforce.com'); });