question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bitbucket Cloud] Authentication keeps failing.

See original GitHub issue

I’m trying to authenticate for bitbucket.org using username@company.com. I created an API Token and I am using it as a password.

`bitbucket = Bitbucket( url=‘https://api.bitbucket.org’, username=os.getenv(“BITBUCKET_USER”), password=os.getenv(“BITBUCKET_PASSWORD”), cloud=True)

repo = bitbucket.get_repo(‘PROJECT’, ‘REPO’) `

This gets me a requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.bitbucket.org/2.0/projects/PROJECT/repos/REPO

I’m a noob and I am totally fine being told that I have done a stupid but I can’t seem to get the authorization to work. I am willing to add documentation for bitbucket cloud if someone tells me how this is supposed to work.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jensvogcommented, Jan 4, 2021

Hi @gonchik, I think this issue can be closed. The error is because the thread starter used his E-Mail and an API Token (App password) for authentication. As mentioned, if you use an API Token (App password), you have to use your bitbucket username for log-in. That is a limitation from Bitbucket. It does not work with the E-Mail.

If you are using app passwords you have to use your username instead of your E-Mail. You can find your username under: Your profile and settings -> Account settings -> Bitbucket profile settings. Source

This is now also stated in the documentation by the PR mentioned above.

0reactions
gonchikcommented, Jan 4, 2021

@jensvog thank you for your input and changes!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bitbucket: Authentication failed - since March 1st 2022
It seems the issue you are facing is due to the recent account password deprecation that happened on March 1st 2022, and you...
Read more >
atlassian sourcetree - Authentication failed to bitbucket
Navigate to C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree and delete (or rename) the file named passwd. Restart SourceTree and execute a command (e.g. ...
Read more >
Bitbucket Authentication Failed | Overview of ... - eduCBA
So first, we need to verify the user's login credential on the Bitbucket server. There are many causes for authentication failed errors, such...
Read more >
Create a Bitbucket App Password example - TheServerSide.com
To avoid a fatal invalid credentials or authentication failed Bitbucket error on login, you must use a Bitbucket App password as part of ......
Read more >
Deprecating Atlassian account password for Bitbucket API and ...
Bitbucket previously shared that starting March 1, 2022, users will not be able to use their Atlassian account password to authenticate with the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found