Skip to Content

Bitbucket Social Login

The Bitbucket social connection (type bitbucket) lets users sign in with their Bitbucket Cloud account. Bring your own app β€” there is no shared Faable app for Bitbucket, so you create an OAuth consumer in one of your workspaces. Bitbucket Data Center and Server are not supported.

Faable sends users to https://bitbucket.org/site/oauth2/authorize, exchanges the code at https://bitbucket.org/site/oauth2/access_token (authenticating with HTTP Basic), reads the account from https://api.bitbucket.org/2.0/user, and the email from https://api.bitbucket.org/2.0/user/emails.

Prerequisites

  • A Bitbucket Cloud workspace where you are an admin.
  • Your Faable Auth domain ({YOUR_FAABLEAUTH_NAME}.auth.faable.link or your custom domain).

Find your redirect URI

In the Faable Dashboard, go to Auth β†’ Connections β†’ Create β†’ Social and pick Bitbucket. Copy the Callback URL shown in the form β€” it is https://{YOUR_DOMAIN}/callback. With a custom domain both hosts are listed; Bitbucket takes a single Callback URL, so use the host your apps start logins on.

Register the app with Bitbucket

  1. In Bitbucket, open Workspace settings β†’ OAuth consumers and click Add consumer.
  2. Fill in:
    • Name: shown on the consent screen.
    • Callback URL: the Callback URL.
    • Permissions β†’ Account: Email and Read.
  3. Save, expand the consumer and copy its Key and Secret.

Create the connection in Faable Auth

FieldValue to Provide
NameAn identifier such as bitbucket. Shown in the dashboard and logs.
Client IDThe consumer Key.
Client secretThe consumer Secret.
ScopesComma-separated. Leave empty for the default account email.
EnabledOn to offer it on the login screen right away.

The endpoints are preconfigured; you don’t enter them.

Scopes

The default scope is account email. Bitbucket only grants scopes that are also ticked as permissions on the consumer, so keep the two in sync.

User profile mapping

Faable user fieldSourceNotes
iduuid from /2.0/userKept with its braces, e.g. {1a2b…}.
namedisplay_name, else nickname
picturelinks.avatar.href
email/2.0/user/emailsThe primary confirmed address, else any confirmed one.
email_verifiedtrue when the email came from that listAttested β€” only confirmed addresses are used.

Unconfirmed addresses are never used: a user with no confirmed email is created without one. Identities are keyed by the Bitbucket uuid plus the connection, never by email. Because Bitbucket vouches for the address, the user is created with email_verified: true. A Bitbucket login never merges into an existing account that happens to have the same email β€” it is a separate user.

Trigger a login

Pass connection=<connection id or name> on /authorize to skip the login screen:

https://{YOUR_DOMAIN}/authorize?client_id={YOUR_CLIENT_ID}&response_type=code&redirect_uri={YOUR_APP_CALLBACK}&scope=openid%20profile%20email&state={RANDOM_STATE}&connection=bitbucket

Without connection, Bitbucket appears as an option on the hosted login screen.

Troubleshooting

SymptomLikely cause
Invalid redirect_uriThe consumer’s Callback URL doesn’t match the host the login started on.
invalid_scopeA scope on the connection isn’t ticked as a permission on the consumer.
User has no emailThe user has no confirmed address on Bitbucket, or the Email permission is off.
Cannot fetch accessTokenKey / Secret mismatch.

Last updated on