documentation cd
Signed-off-by: Filip Swiatczak <filip.swiatczak@gmail.com>
This commit is contained in:
@@ -1,30 +1,28 @@
|
||||
---
|
||||
id: provider
|
||||
title: GitHub Authentication Provider
|
||||
sidebar_label: GitHub
|
||||
description: Adding GitHub OAuth as an authentication provider in Backstage
|
||||
title: Bitbucket Authentication Provider
|
||||
sidebar_label: Bitbucket
|
||||
description: Adding Bitbucket OAuth as an authentication provider in Backstage
|
||||
---
|
||||
|
||||
The Backstage `core-api` package comes with a GitHub authentication provider
|
||||
that can authenticate users using GitHub or GitHub Enterprise OAuth.
|
||||
The Backstage `core-api` package comes with a Bitbucket authentication provider
|
||||
that can authenticate users using Bitbucket Cloud. This does **NOT** work with
|
||||
Bitbucket Server.
|
||||
|
||||
## Create an OAuth App on GitHub
|
||||
## Create an OAuth Consumer in Bitbucket
|
||||
|
||||
To add GitHub authentication, you must create either a GitHub App, or an OAuth
|
||||
App from the GitHub
|
||||
[developer settings](https://github.com/settings/developers). The `Homepage URL`
|
||||
should point to Backstage's frontend, while the `Authorization callback URL`
|
||||
will point to the auth backend.
|
||||
To add Bitbucket Cloud authentication, you must create an OAuth Consumer.
|
||||
|
||||
Note that if you're using a GitHub App, the allowed scopes are configured as
|
||||
part of that app. This means you need to verify what scopes the plugins you use
|
||||
require, so be sure to check the plugin READMEs for that information.
|
||||
Go to `https://bitbucket.org/<your-project-name>/workspace/settings/api` .
|
||||
|
||||
Click Add Consumer.
|
||||
|
||||
Settings for local development:
|
||||
|
||||
- Application name: Backstage (or your custom app name)
|
||||
- Homepage URL: `http://localhost:3000`
|
||||
- Authorization callback URL: `http://localhost:7000/api/auth/github`
|
||||
- Callback URL: `http://localhost:7000/api/auth/bitbucket`
|
||||
- Other are optional
|
||||
- (IMPORTANT) **Permissions: Account - Read, Workspace membership - Read**
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -35,32 +33,38 @@ root `auth` configuration:
|
||||
auth:
|
||||
environment: development
|
||||
providers:
|
||||
github:
|
||||
bitbucket:
|
||||
development:
|
||||
clientId: ${AUTH_GITHUB_CLIENT_ID}
|
||||
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
|
||||
## uncomment if using GitHub Enterprise
|
||||
# enterpriseInstanceUrl: ${AUTH_GITHUB_ENTERPRISE_INSTANCE_URL}
|
||||
clientId: ${AUTH_BITBUCKET_CLIENT_ID}
|
||||
clientSecret: ${AUTH_BITBUCKET_CLIENT_SECRET}
|
||||
```
|
||||
|
||||
The GitHub provider is a structure with three configuration keys:
|
||||
The Bitbucket provider is a structure with two configuration keys:
|
||||
|
||||
- `clientId`: The client ID that you generated on GitHub, e.g.
|
||||
- `clientId`: The Key that you generated in Bitbucket, e.g.
|
||||
`b59241722e3c3b4816e2`
|
||||
- `clientSecret`: The client secret tied to the generated client ID.
|
||||
- `enterpriseInstanceUrl` (optional): The base URL for a GitHub Enterprise
|
||||
instance, e.g. `https://ghe.<company>.com`. Only needed for GitHub Enterprise.
|
||||
- `clientSecret`: The Secret tied to the generated Key.
|
||||
|
||||
## Adding the provider to the Backstage frontend
|
||||
|
||||
To add the provider to the frontend, add the `githubAuthApi` reference and
|
||||
`SignInPage` component as shown in
|
||||
[Adding the provider to the sign-in page](../index.md#adding-the-provider-to-the-sign-in-page).
|
||||
Ensure identityProviders contains Bitbucket at
|
||||
`packages/app/src/identityProviders.ts`:
|
||||
|
||||
## Difference between GitHub Apps and GitHub OAuth Apps
|
||||
```yaml
|
||||
import {
|
||||
...
|
||||
bitbucketAuthApiRef,
|
||||
...
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
GitHub Apps handle OAuth scope at the app installation level, meaning that the
|
||||
`scope` parameter for the call to `getAccessToken` in the frontend has no
|
||||
effect. When calling `getAccessToken` in open source plugins, one should still
|
||||
include the appropriate scope, but also document in the plugin README what
|
||||
scopes are required for GitHub Apps.
|
||||
export const providers = [
|
||||
...
|
||||
{
|
||||
id: 'bitbucket-auth-provider',
|
||||
title: 'Bitbucket',
|
||||
message: 'Sign In using Bitbucket Cloud',
|
||||
apiRef: bitbucketAuthApiRef,
|
||||
},
|
||||
...
|
||||
];
|
||||
```
|
||||
|
||||
@@ -140,6 +140,7 @@ nav:
|
||||
- Google: 'auth/google/provider.md'
|
||||
- Okta: 'auth/okta/provider.md'
|
||||
- OneLogin: 'auth/onelogin/provider.md'
|
||||
- Bitbucket: 'auth/bitbucket/provider.md'
|
||||
- Adding authentication providers: 'auth/add-auth-provider.md'
|
||||
- Using authentication and identity: 'auth/using-auth.md'
|
||||
- Sign in resolvers: 'auth/identity-resolver.md'
|
||||
|
||||
Reference in New Issue
Block a user