Skip to content

Token Authorization doesn't seem to be working #135

@sh-ghanique

Description

@sh-ghanique

What am I doing wrong here?

Consider the following code:

import { Bitbucket } from "bitbucket";

const apiToken = 'Token as copied from https://id.atlassian.com/manage/api-tokens';
const bitbucket = new Bitbucket({
  baseUrl: 'https://api.bitbucket.org/2.0',
  auth: {
    token: apiToken,
  }
});

const repos = bitbucket.user.get({}).then(value => {
  console.log(value.data);
});

Steps to reproduce

  1. Go to https://id.atlassian.com/manage/api-tokens
  2. Create a new API token.
  3. Copy the API token
  4. In the code above replace "Token as copied from https://id.atlassian.com/manage/api-tokens'" with the API token.
  5. Run the code.

Expected

The current user is being logged.

Actual

BITBUCKET CLOUD API LATEST UPDATES:  https://developer.atlassian.com/cloud/bitbucket 
index.ts:11
Process exited with code 1
Uncaught i HTTPError: Unauthorized
    at <anonymous> (/wrk/bitbucket/node_modules/bitbucket/src/request/fetch-wrapper.ts:48:17)
    at processTicksAndRejections (internal/process/task_queues:95:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions