Skip to content

Commit d2e94b1

Browse files
CrazyBaranclaude
andcommitted
docs(auth): scope Bitbucket Cloud examples to api.bitbucket.org
Copilot review round 3 on #4629: both ready-to-paste Bitbucket Cloud examples listed hosts=["api.bitbucket.org", "bitbucket.org"], but Bitbucket Cloud splits its auth surface by host. Verified against Atlassian's docs (support.atlassian.com/bitbucket-cloud/docs/ using-access-tokens/) and developer.atlassian.com/cloud/bitbucket/rest/, plus a live probe (bitbucket.org/.../raw/... varies its response on the `authorization` header, consistent with HTTP Basic, not Bearer): - api.bitbucket.org accepts Bearer access tokens and Basic with an Atlassian API token on any REST call. - The plain bitbucket.org web host (raw links, git-over-HTTPS) does not accept either — it authenticates via HTTP Basic with the literal username x-token-auth and the access token as the password, a different credential shape than either documented example produces. Restrict both examples' `hosts` to `api.bitbucket.org`, and point catalog fetches at the API's `/2.0/repositories/<ws>/<repo>/src/<ref>/<path>` form instead of `bitbucket.org/.../raw/...`, so the credential in auth.json actually authenticates the request it's attached to. No code changes — the provider already implements both schemes correctly; only the documented host scope was wrong. Assisted-by: Claude Code (model: claude-sonnet-5, human-supervised) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 2317f90 commit d2e94b1

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

‎docs/reference/authentication.md‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,28 +146,42 @@ Requires `az login` to have been run beforehand.
146146

147147
| Scheme | Header | Use for |
148148
|---|---|---|
149-
| `bearer` | `Authorization: Bearer <token>` | Repository / project / workspace access tokens (Bitbucket Cloud), HTTP access tokens (Bitbucket Data Center) |
150-
| `basic` | `Authorization: Basic base64(<username>:<token>)` | Atlassian API tokens (username = Atlassian account email). Bitbucket Cloud app passwords were removed by Atlassian on July 28, 2026 — use an API token or an access token instead. |
149+
| `bearer` | `Authorization: Bearer <token>` | Repository / project / workspace access tokens and Atlassian API tokens (Bitbucket Cloud, **`api.bitbucket.org` only** — see note below), HTTP access tokens (Bitbucket Data Center) |
150+
| `basic` | `Authorization: Basic base64(<username>:<token>)` | Atlassian API tokens (username = Atlassian account email) against `api.bitbucket.org`. Bitbucket Cloud app passwords were removed by Atlassian on July 28, 2026 — use an API token or an access token instead. |
151+
152+
> **Host note:** Bitbucket Cloud splits its surface by host. `api.bitbucket.org`
153+
> accepts a Bearer access token or Basic-with-Atlassian-API-token on any
154+
> REST call, including fetching a catalog file via
155+
> `GET /2.0/repositories/<workspace>/<repo>/src/<ref>/<path>`. The plain
156+
> `bitbucket.org` web host (browser pages, `.../raw/...` links, `git clone`
157+
> over HTTPS) does **not** accept either of those — it authenticates
158+
> git-over-HTTPS with HTTP Basic using the literal username `x-token-auth`
159+
> and the access token as the password. Point catalog and `download_url`
160+
> entries at `api.bitbucket.org` (below) rather than `bitbucket.org/.../raw/...`
161+
> so the credentials in your `auth.json` actually apply.
151162
152163
**Example — Bitbucket Cloud access token (recommended):**
153164

154165
```json
155166
{
156-
"hosts": ["api.bitbucket.org", "bitbucket.org"],
167+
"hosts": ["api.bitbucket.org"],
157168
"provider": "bitbucket",
158169
"auth": "bearer",
159170
"token_env": "BITBUCKET_ACCESS_TOKEN"
160171
}
161172
```
162173

163174
Create the token with the **Repositories: Read** scope on the repository
164-
(or project/workspace) that hosts your catalogs and archives.
175+
(or project/workspace) that hosts your catalogs and archives. Fetch a
176+
catalog file with this credential via
177+
`https://api.bitbucket.org/2.0/repositories/<workspace>/<repo>/src/<ref>/catalog.json`
178+
rather than a `bitbucket.org/.../raw/...` URL.
165179

166180
**Example — Atlassian API token (Basic auth):**
167181

168182
```json
169183
{
170-
"hosts": ["api.bitbucket.org", "bitbucket.org"],
184+
"hosts": ["api.bitbucket.org"],
171185
"provider": "bitbucket",
172186
"auth": "basic",
173187
"username": "you@example.com",

0 commit comments

Comments
 (0)