Forums

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

Only possible to switch to API Token when username is switched to e-mail

R J Janssen
August 16, 2026

I created an API key in Bitbucket as indicated in the Sourcetree documentation with scopes as indicated.

Then in Sourcetree I wanted to change my account (with existing username) over to API Token. I entered my correct e-mail below the dropdown and set my existing username in the dialog that follows. But then the API key is not recognized and error 'Failed to get user details, You do not have permission to access URL etc. request returns with status Unauthorized.

The only way to let the API token be accepted is when I set the username to my e-mail address. But then of course no repository actions will work anymore.

Removing old entries in Credential Manager (I am doing this on Windows) did not solve the problem.

How to solve this, now unable to use Sourcetree ;-[

3 answers

1 accepted

2 votes
Answer accepted
Tinker Fadoua
Community Champion
August 16, 2026
R J Janssen
August 17, 2026

@Tinker Fadoua Thanks for this suggestion it worked when changing the URL of the repository settings using this format:

git clone https://<bitbucket_username>:<api_token>@bitbucket.org/<workspace>/<repo>.git  

I tought of this before but hesitated to paste the very long API Token in this URL. 

This piece of info was indeed the clue,

Roelof

Like Tomislav Tobijas likes this
0 votes
R J Janssen
August 16, 2026

To avoid the problem I 

  • Removed all git* entries in Credential Manager
  • Added an account switching to oAuth with the existing username.

But then pushing fails with:

remote: CHANGE-3222 - Functionality has been deprecated
remote: App passwords are deprecated and must be replaced with API tokens.
remote: https://developer.atlassian.com/cloud/bitbucket/changelog#CHANGE-3222
fatal: unable to access 'https://bitbucket.org/RoelofSandP/xmaps_portal.git/': The requested URL returned error: 410

So oAuth workaround fails.....

Using version Windows 3.4.31 (latest as of today)

 

Tomislav Tobijas
Community Champion
August 17, 2026

@R J Janssen 🫤

Thanks for providing additional info!

Have you maybe tried following the steps in the link Fadoua provided?

0 votes
Tomislav Tobijas
Community Champion
August 16, 2026

Hey @R J Janssen ,

Are we talking about Bitbucket on-prem or cloud? Also, when you say

...no repo actions will work anymore...

what do you mean by that? 🤔 Are we talking about authentication under Tools → Options → Authentication succeeds after changing the username to your email address, but operations such as fetch/pull/push against an existing repository then fail?
If so, can you share which error do you get?

Generally speaking:

  • App Password = Bitbucket username + App Password.
  • API Token = Atlassian account email + API Token

Note that existing Git credentials can sometimes still be cached separately.

I would also check/remove any existing Bitbucket credentials from Windows Credential Manager (as you did) and verify the repository's configured remote URL under Repository Settings → Remotes. 👀

Cheers,
Tobi

R J Janssen
August 16, 2026

Local Windows client and cloud repo.

By repository changes I meant push/pull etc.

Like Tomislav Tobijas likes this
R J Janssen
August 16, 2026

The error I get after a push I added in the first answer. 

The remote URL of the repository I am pushing to still contains my existing user name  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events