fix(auth): use default scope account for Bitbucket auth
Fixes https://github.com/backstage/backstage/issues/22383 The scope `team` does not exist, a list of valid OAuth2 scopes can be found here: - https://developer.atlassian.com/cloud/bitbucket/rest/intro/#bitbucket-oauth-2-0-scopes The `passport-bitbucket-oauth2` package implementing OAuth2 for Bitbucket under the hood uses the `/2.0/user` API to retrieve the user information, which requires the `account` scope: - https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get - https://github.com/bithound/passport-bitbucket-oauth2/blob/master/lib/passport-bitbucket/strategy.js#L60 Signed-off-by: Martin Ohmann <martin.ohmann@bonial.com>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/app-defaults': patch
|
||||
'@backstage/core-app-api': patch
|
||||
'@backstage/test-utils': patch
|
||||
---
|
||||
|
||||
Change `defaultScopes` for Bitbucket auth from invalid `team` to `account`.
|
||||
@@ -224,7 +224,7 @@ export const apis = [
|
||||
configApi,
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
defaultScopes: ['team'],
|
||||
defaultScopes: ['account'],
|
||||
environment: configApi.getOptionalString('auth.environment'),
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -52,7 +52,7 @@ export default class BitbucketAuth {
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['team'],
|
||||
defaultScopes = ['account'],
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
|
||||
@@ -183,7 +183,7 @@ export const defaultApis = [
|
||||
configApi,
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
defaultScopes: ['team'],
|
||||
defaultScopes: ['account'],
|
||||
environment: configApi.getOptionalString('auth.environment'),
|
||||
}),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user