Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to authenticate with Bitbucket since moving to API tokens!

Ed Williams November 7, 2025

I switched to API token this morning as we are told app passwords are depreciated and we are forced to move this way. However since doing this I'm totally locked out from bitbucket via SourceTree! I have tried absolutely everything!

Deleted passwd file

Tried both email address and user addy in combination with API Token and my password. No combination hits.

I'm getting Authentication failed. Failed to get user details. You do not have permission to access URL https://api.bitbucket.org/2.0/user.

Well this is just stupid! What the hell am I meant to do. I've delete and reset token multiple times, changed my password. Reinstalled, deleted files. Such a terrible system I'm seriously thinking of shifting all our stuff to Github and be done with it.

If anyone has any ideas, otherwise I'll plan to start migrating next week as it is holding our work up.

1 answer

0 votes
Tomislav Tobijas
Community Champion
November 7, 2025

Hey @Ed Williams ,

Which Sourcetree version are you using? I believe API tokens are only supported in Windows 3.4.24+ or macOS 4.2.13+
If you're on an older version, authentication will fail.

Also, API tokens used to perform Git commands must have scopes - see Using API tokens.

These instructions should work:

  1. Generate an API Token:

    • Go to Bitbucket Cloud > Personal Settings > API tokens.

    • Create a new token with the necessary scopes (read/write for repositories).

  2. Configure Sourcetree:

    • Go to Settings (or Preferences) > Accounts.

    • Add or edit your Bitbucket Cloud account.

    • Set Auth Type to API Token.

    • Enter your Bitbucket Cloud email address (not username) in the User Email field.

    • Paste your API token in the API Token field and save.

  3. Remove Old Credentials:

    • Open your system’s credential manager (Windows Credential Manager or macOS Keychain).

    • Delete any entries related to bitbucket.org.

    • Restart Sourcetree and re-enter your credentials with the API token.

What you might try is to use the command line with your API token and try cloning or pushing to see if it will work there. (If it works, you'll know it's Sourcetree issue) 👀

Additional materials: Add an API token to Sourcetree or another application 

Cheers,
Tobi

Ed Williams November 7, 2025

@Tomislav Tobijas Thanks for your reply. After reinstallation again from scratch and following the above I have now got a different error which is around what permissions I should give in the API scope. I gave it read account and read/write repositories but it is still complaining about 'Failed to get user details' Lack one or more privilege scopes etc. Can't find anything only about what scope permission should be for SourceTree use.

Ed Williams November 7, 2025

@Tomislav Tobijas I have now got this working finally. However I'm still getting a login prompt when I try to push. Which was the original problem I had last night after installing Git LFS. It keeps looping credentialhelperselection dialogue and regardless what combination of details I put in. It just loops :/

Tomislav Tobijas
Community Champion
November 9, 2025

Glad at least there are some updates about this (even if you actually got back to the initial problem).

...I have now got a different error which is around what permissions I should give in the API scope...

I think your API token should include full repo scope, not just read or write, but the entire repo permission.

Also, is your remote URL HTTPS? Note that API tokens do not work with SSH.

I've just tested this and I got it working with the following setup (I've used Bitbucket cloud):

  • Preferred Protocol: HTTPS
  • Authentication: Basic
  • Username: Atlassian Account email

2025-11-09_15-46-23.png

After clicking on "Refresh App Password", in the prompt for "Password", I've added the newly created API token. 👇

2025-11-09_15-41-02.png

Note that I've created an API token via https://id.atlassian.com/manage-profile/security/api-tokens > Create API token with scopes

  • App: Bitbucket
  • Select all Bitbucket scopes (I mean, I haven't tried it with only partial scopes)

2025-11-09_15-44-29.png

I haven't worked or troubleshooted that much those issues with credential managers so I'm not sure what else you could check :/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events