Configuring OAuth 2.0 for the Bitbucket Cloud

You can enable users to work with a remote Git repository that is hosted in the Bitbucket Cloud:

  1. Set up an OAuth consumer (OAuth 2.0) in the Bitbucket Cloud.

  2. Apply an OAuth consumer Secret for the Bitbucket Cloud.

Setting up an OAuth client in the Bitbucket Cloud

Set up an OAuth client for OAuth 2.0 in the Bitbucket Cloud.

Prerequisites
  • You are logged in to the Bitbucket Cloud.

Procedure
  1. Click the Gear(Settings) icon and go to the Workspace Settings page.

  2. Go to Apps and features  OAuth clients  Create OAuth client.

  3. In the Details tab enter Che as the Name.

  4. In the Authorization tab click the Authorization code checkbox and enter https://<che_fqdn>/api/oauth/callback as the Callback URL.

  5. In the Copes tab check all of the Account and Repositories checkboxes, and click Save.

  6. Copy and save the Client ID value for use when applying the Bitbucket OAuth client Secret:

  7. Copy and save the Secret value for use when applying the Bitbucket OAuth client Secret.

Applying an OAuth client Secret for the Bitbucket Cloud

Prepare and apply an OAuth client Secret for the Bitbucket Cloud.

Prerequisites
  • The OAuth client is set up in the Bitbucket Cloud.

  • The following values, which were generated when setting up the Bitbucket OAuth client, are prepared:

    • Bitbucket OAuth client ID

    • Bitbucket OAuth client Secret

  • An active kubectl session with administrative permissions to the destination Kubernetes cluster. See Overview of kubectl.

Procedure
  1. Prepare the Secret:

    kind: Secret
    apiVersion: v1
    metadata:
      name: bitbucket-oauth-config
      namespace: eclipse-che (1)
      labels:
        app.kubernetes.io/part-of: che.eclipse.org
        app.kubernetes.io/component: oauth-scm-configuration
      annotations:
        che.eclipse.org/oauth-scm-server: bitbucket
    type: Opaque
    stringData:
      id: <Bitbucket_Oauth_client_Key> (2)
      secret: <Bitbucket_Oauth_client_Secret> (3)
    1 The Che namespace. The default is eclipse-che.
    2 The Bitbucket OAuth client ID.
    3 The Bitbucket OAuth client Secret.
  2. Apply the Secret:

    $ kubectl apply -f - <<EOF
    <Secret_prepared_in_the_previous_step>
    EOF
  3. Verify in the output that the Secret is created.