SourceTree: 3.4.31
OS: Win10
Browser Edge: 150.0.4078.65
Tools > Options > Authentication >
When I edit/add an account in Sourcetree and press the 'Refresh API Token' button and enter the API Token I get the message below:
Authentication failed
Failed to get user details. You do not have permission to access URL 'https:/api.bitbucket.org/2.0/user'. The request returned with status code 'Unauthorized'. API token must be used with an atlassian registered email.
I double checked the Email address (I have only one account) and the API token works with the 'URL method'.
Hi @Thomas Krenn ,
Can you try clearing your credential manager? There have been some discussions around this, but here's one example of how things will/might look: https://community.atlassian.com/forums/Sourcetree-questions/Setting-up-API-Token-with-SourceTree/qaa-p/3261626#M47510
As for how to create an API token, can you try following these steps (once you clear the credential manager): https://community.atlassian.com/forums/Sourcetree-questions/Unsure-how-to-use-the-API-password-with-sourcetree/qaa-p/3184506#M46897
Cheers,
Tobi
Your second guess is the right one. The kibsa.at address is your Atlassian account, and that's what belongs in User Email.
The other one isn't an account at all. That's the bit tripping you up. In a remote like https://name@bitbucket.org/workspace/repo.git you're looking at git's own user@host syntax, where the part before the @ is your Bitbucket username and bitbucket.org is the host it's talking to. It reads like an email because the URL format makes it look like one, but there's no Atlassian account registered under it. So if that's what went into the field, the error was doing its job when it said "must be used with an atlassian registered email".
So if the failed attempt had the bitbucket.org one in that field, give it one more go with kibsa.at. If you'd already used kibsa.at and it still bounced, you've hit the shakier side of SourceTree's token handling and I'd stop there. OAuth is working for you, it doesn't lean on a credential helper at all, and someone on a near-identical thread last week ended up in the same place and it's held since.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That error is coming from SourceTree's account check, not from git. It calls api.bitbucket.org/2.0/user to read your profile, and that call wants your Atlassian account email as the username. Git wants x-bitbucket-api-token-auth instead, which is why the same token sails through the URL method while the Accounts tab keeps refusing.
Your version is fine, so don't chase that. API tokens are supported from 3.4.24 on Windows and you're on 3.4.31.
I'd suspect the account entry rather than the token. The message is SourceTree telling you the identity it sent wasn't an Atlassian-registered email, and an entry first created back in the app-password days can still be carrying your Bitbucket username underneath, with Refresh API Token quietly reusing it. Remove the account completely. Then add it again with Auth Type set to API Token, your Atlassian email in User Email, token in the API Token field.
If it still bounces after a clean re-add, switch that account to OAuth. SourceTree holds the token itself there, so no credential helper is involved and there's nothing cached to fall back on. Someone hit the same runaround on a near-identical thread last week, went OAuth, and reported back that it's held up since.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Gabriela for your feedback!
I deleted the account and the API Token method still doesn't work. (same error)
The OAuth method works.
Just to clarify:
[name]@bitbucket.org is my Atlassian account name. Right?! (Looks like an email address too and is used in the remote repo path)
[name]@kibsa.at (My austrian email address that I used to sign up) is the User Email that should be entered in the authentication dialog. Right?!
Best regards
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.