diff --git a/packages/integration-react/report.api.md b/packages/integration-react/report.api.md index c1a2e34907..ee6eb0f40a 100644 --- a/packages/integration-react/report.api.md +++ b/packages/integration-react/report.api.md @@ -55,6 +55,10 @@ export class ScmAuth implements ScmAuthApi { bitbucketAuthApi: OAuthApi, options?: { host?: string; + scopeMapping?: { + default?: string[]; + repoWrite?: string[]; + }; }, ): ScmAuth; static forGithub( diff --git a/packages/integration-react/src/api/ScmAuth.ts b/packages/integration-react/src/api/ScmAuth.ts index 6257915c8c..a751e43ce4 100644 --- a/packages/integration-react/src/api/ScmAuth.ts +++ b/packages/integration-react/src/api/ScmAuth.ts @@ -226,12 +226,28 @@ export class ScmAuth implements ScmAuthApi { bitbucketAuthApi: OAuthApi, options?: { host?: string; + scopeMapping?: { + default?: string[]; + repoWrite?: string[]; + }; }, ): ScmAuth { const host = options?.host ?? 'bitbucket.org'; + const defaultScopes = options?.scopeMapping?.default ?? [ + 'account', + 'team', + 'pullrequest', + 'snippet', + 'issue', + ]; + const repoWriteScopes = options?.scopeMapping?.repoWrite ?? [ + 'pullrequest:write', + 'snippet:write', + 'issue:write', + ]; return new ScmAuth('bitbucket', bitbucketAuthApi, host, { - default: ['account', 'team', 'pullrequest', 'snippet', 'issue'], - repoWrite: ['pullrequest:write', 'snippet:write', 'issue:write'], + default: defaultScopes, + repoWrite: repoWriteScopes, }); }