diff --git a/.changeset/chatty-days-wonder.md b/.changeset/chatty-days-wonder.md new file mode 100644 index 0000000000..5e5114c28e --- /dev/null +++ b/.changeset/chatty-days-wonder.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth-backend-module-bitbucket-provider': patch +--- + +Enabled persistency of scopes for Bitbucket Cloud. diff --git a/.changeset/serious-guests-tan.md b/.changeset/serious-guests-tan.md new file mode 100644 index 0000000000..c051dca464 --- /dev/null +++ b/.changeset/serious-guests-tan.md @@ -0,0 +1,5 @@ +--- +'@backstage/integration-react': patch +--- + +Added scope `project` for Bitbucket Cloud. diff --git a/packages/integration-react/src/api/ScmAuth.test.ts b/packages/integration-react/src/api/ScmAuth.test.ts index d252b95b85..5872354d79 100644 --- a/packages/integration-react/src/api/ScmAuth.test.ts +++ b/packages/integration-react/src/api/ScmAuth.test.ts @@ -129,7 +129,7 @@ describe('ScmAuth', () => { await expect( bitbucketAuth.getCredentials({ url: 'http://example.com' }), ).resolves.toMatchObject({ - token: 'account team pullrequest snippet issue', + token: 'account team pullrequest snippet issue project', }); await expect( bitbucketAuth.getCredentials({ @@ -138,7 +138,7 @@ describe('ScmAuth', () => { }), ).resolves.toMatchObject({ token: - 'account team pullrequest snippet issue pullrequest:write snippet:write issue:write', + 'account team pullrequest snippet issue project pullrequest:write snippet:write issue:write', }); }); @@ -195,7 +195,8 @@ describe('ScmAuth', () => { }, }), ).resolves.toMatchObject({ - token: 'account team pullrequest snippet issue snippet:write issue:write', + token: + 'account team pullrequest snippet issue project snippet:write issue:write', }); }); diff --git a/packages/integration-react/src/api/ScmAuth.ts b/packages/integration-react/src/api/ScmAuth.ts index ff3e8c098d..011422d4cf 100644 --- a/packages/integration-react/src/api/ScmAuth.ts +++ b/packages/integration-react/src/api/ScmAuth.ts @@ -239,6 +239,7 @@ export class ScmAuth implements ScmAuthApi { 'pullrequest', 'snippet', 'issue', + 'project', ]; const repoWriteScopes = options?.scopeMapping?.repoWrite ?? [ 'pullrequest:write', diff --git a/plugins/auth-backend-module-bitbucket-provider/src/authenticator.ts b/plugins/auth-backend-module-bitbucket-provider/src/authenticator.ts index a2d8275964..e07d9caf98 100644 --- a/plugins/auth-backend-module-bitbucket-provider/src/authenticator.ts +++ b/plugins/auth-backend-module-bitbucket-provider/src/authenticator.ts @@ -28,6 +28,7 @@ export const bitbucketAuthenticator = createOAuthAuthenticator({ PassportOAuthAuthenticatorHelper.defaultProfileTransform, scopes: { required: ['account'], + persist: true, }, initialize({ callbackUrl, config }) { const clientID = config.getString('clientId'); diff --git a/plugins/auth-backend-module-bitbucket-provider/src/module.test.ts b/plugins/auth-backend-module-bitbucket-provider/src/module.test.ts index f1426d1b0d..6dddfb1d63 100644 --- a/plugins/auth-backend-module-bitbucket-provider/src/module.test.ts +++ b/plugins/auth-backend-module-bitbucket-provider/src/module.test.ts @@ -73,6 +73,7 @@ describe('authModuleBitbucketProvider', () => { expect(decodeOAuthState(startUrl.searchParams.get('state')!)).toEqual({ env: 'development', nonce: decodeURIComponent(nonceCookie.value), + scope: 'account', }); }); });