Authenticating with Bitbucket not possible

I recently tried to set up my dev environment on a new macbook.

  • Sourcetree 2.4 (90)
  • maxOS Sierra 10.12.3 Beta (16D25a)

I first tried to authenticate using HTTPS with Bitbucket but even after verifying/resetting my password multiple times, I can just not login, I just get a very random error message:

Could not authorize request with the available token. Please re-authenticate.

To login, I have tried adding my Bitbucket account through 'preferences/accounts'

Screenshot 2017-01-12 15.15.15.png

After supplying my credentials it sometimes briefly loads my avatar correctly, like it does for GitHub but upon loading repository browser, it instantly unloads the avatar and throws the error above:

Screenshot 2017-01-12 15.19.32.png

This is getting very annoying, very quickly... 

Moreover, even though I have correctly generated an SSH key pair and added the public keys to my GitHub and Bitbucket accounts, the Sourcetree account UI refuses to 'see' or let me add my keys... it insists on generating new ones. Why is that?

Screenshot 2017-01-12 15.22.45.png

Screenshot 2017-01-12 15.22.54.png

Like this, Sourcetree is effectively useless ...

EDIT

The above issue presents itself when trying HTTPS authentication in combination with OAuth. If instead 'basic' authentication is chosen, repo browser seems to load remotes correctly. However, occasionally I still seem to get logged out.

 

27 answers

Hi all,

The addition of OAuth was a fundamental architecture change for SourceTree on macOS and unfortunately there have been a number issues centered around how tokens are stored and accessed in the keychain that we've spent a lot of time investigating for the next update (2.5.2). That release is available here as OSX_Beta_Latest.zip currently with a refresh coming tomorrow (you can sign up for the trusted_testers mailing list to be notified of updates.) Full details: 2.5.2 Release Notes

We greatly appreciate our community's patience as we deal with these growing pains and varying implementation details such as hourly token timeouts or newly introduced rate limiting. Once 2.5.2 is generally available if you're still encountering problems we'd ask that you reach out either via a ticket on JIRA or Atlassian Support, depending on your preferences. Rest assured, we're reading your feedback in all channels and striving to make the product better with each release.

Brian Ganninger
Senior Mac Developer, SourceTree

The new build, 2.5.2 (109), is now available as a beta.

Brian, I've tried the beta version (2.5.2), still doesn't work.

Please file a ticket on JIRA (see previous posts) and we'll follow up on debugging details. Thanks for your patience.

So the issue really does seem to be that if you have the same username on your github and bitbucket accounts, you cannot authorise with bitbucket on a macintosh device. I had this issue until i changed by usernames on both accounts, and I seem to be able to pull down code now. 

My desktop PC and Sourcetree works fine, no issues. Really bizarre problem that Atlassian really needs to look into!

Almost a year after this and still things don’t work. Come on guys... get on it and address it properly.

@Brian Ganninger How about an 'official' reaction?? This issue is still not fixed properly....

6 votes

Hi everybody,

I'd like to start by saying we hear your feedback and understand your frustration. We know how serious this is and apologize for the pain caused by these bugs.

We're a small but dedicated team in Atlassian doing our best to balance everyone's needs. When something like this happens we are keenly aware of how we failed you and know that we need to, and will, do better. Now let’s dig into some of the details and provide clarity around issues for this topic.

Several moving parts affect the authentication processes in Sourcetree for macOS:

    • OAuth tokens that have differing expirations and requirements per hosting service

    • Classic HTTPS username/password challenges

    • Two factor authentication

    • SSH keys (user managed or ST managed)


The following external changes also had an impact:

    • macOS revising how SSH keys are loaded and managed in 10.12 and 10.13 (details)

    • GitHub deprecating and disabling 'weaker' TLS encryption (details)


That complexity is our problem to solve though and you count on us to do it while delivering a rock solid experience, period.

To make tracking down issues less painful we've opened up our internal auth logging via the new Debug menu in 2.7.2. We are dedicated to improving this area, with fixes present in every release since we first started expanding the authentication options. Each sprint includes dedicated time to review and investigate any new authentication reports with test builds often privately shared with those affected.

Filing a ticket (https://jira.atlassian.com/browse/SRCTREE) is the single best way to help out. We review every ticket for how it impacts Sourctree, determine if it’s an existing or duplicate issue, and then follow up if we need more information or clarity.

Beta content, especially bug reporting, is not discussed or triaged on Community because this forum is for public releases - anything related to betas should be discussed on the "Trusted Testers" mailing list (https://groups.google.com/forum/#!forum/atlassian-sourcetree-beta) and/or tickets per the introductory message.

We genuinely want your help when these issues arise. Please vote or comment on an existing ticket; if there isn't one, open a new ticket with as much detail as you can provide. This will help us attack the right problems as fast as we can.

These are the primary tickets we're tracking for future updates:

    • SRCTREE-5368 missing uuid (fix deploying in 2.7.2 beta 4 today)

    • SRCTREE-4544 multiple prompts for SSH Keychain password

    • SRCTREE-5372 multiple password prompts with HTTPS


Thank you for your feedback, patience, and tickets - we strive to make our apps better every day.

Brian Ganninger
Senior Mac Developer, Sourcetree

Thanks for your response. One note - 5372 either doesn't exist or the general public doesn't have permission to view it.

Good catch, fixed.

I am having a similar issue, but for me it's with github.  I was having a similar issue connecting to bitbucket, but was able to get around it by allowing SourceTree to create a new key.

I am having the exact same issue.

os:macOS sierra 10.12.3

SourceTree 2.4

 

when i change the username , everything will be OK

I tried as you said, before i had the same usernames for my Github and Bitbucket accounts. Then i changed the username of my Bitbucket account and everything works now :) 

Changing my account protocol from HTTPS to SSH in Preferences > Accounts solved this problem for me. 

Thanks for this, I was on SSH and changed it to HTTPS and managed to login. Then I changed it back to SSH and it works fine. 

I am having the exact same issue.

Same issue here. It doesn't work for Github OAuth, but Bitbucket is fine.

Same here, no solution yet?

Same issue, couldn't authenticate to github.

same here! I hope there's a fix soon!

I'm also experiencing this issue.

Identical issue here too.

If I am oauth/SSH I get:

Could not authorize request with the available token. Please re-authenticate.

If I am to basic/SSH I get:

The operation couldn’t be completed. (com.google.HTTPStatus error 401.)

If I am oauth/HTTPS I get:

Could not authorize request with the available token. Please re-authenticate.

If I am basic/HTTPS I get signed in, but I have to re-enter my password twice on each pull or push, despite the 'store in keychain' option being set.

Very close to giving up.

This is with BitBucket. GitHub works perfectly for me!  

is your Bitbucket and github account names equal? if so change your Bitbucket account name (just add 2-3 more characters at the end) and retry. i solved my problem just like this.

I tried as you said, before i had the same usernames for my Github and Bitbucket accounts. Then i changed the username of my Bitbucket account and everything works now :) 

It's been two months and I still can't connect sad

Same issue here. Fix this please!!! SourceTree 2.4.1 MacOS sierra.

Same issue started happening suddenly for no apparent reason.

"Could not authorize request with the available token. Please re-authenticate."

And am CONSTANTLY receiving prompts to enter BitBucket password, even when there are several prompts already displayed.

SourceTree v2.5 (104)
MacOS v10.12.4 (16E195)

Issue persists after performing the following:

  • Have removed all accounts from SourceTree
  • Removed all ssh keys
  • Removed SourceTree's generated .ssh/config
  • Removed all BitBucket/Atlassian passwords from KeyChain
  • Added my BitBucket account to SourceTree again (OAuth)
  • Generated new ssh key

My BitBucket and GitHub usernames are the same, but I'm not even trying to add GitHub at the moment.

That's what happens on mine as well. 

It seems related to High Sierra Mac OsX, and the current version of Sourcetree as of January 2018.

I fixed mine by changing my username on Bitbucket, but I still get intermittent issues around auth and saving my password to keychain. 

Same issue. It's getting extremely annoying...

Any body solved this issue without changing usernames?

No. Can't understand why there's been no response either.

You might havre mentioned that you need to download an early build for things to work.

The officially available 2.5.2 (105) still has issues.

The build that actually fixes things is 2.5.2 (111)

I still have 2.5.2 (105), but it's good to know 2.5.2 (111) fix the issue.

Well in 105, the issue definitely was not resolved. But anyway...

One of the latest builds for macOS seems to resolve the matter finally:

2017-05-26

Actual version no is 2.5.2, build 111

Knock on wood...

 

 

Hi, I've tried 2.5.3c and 2.6.3a on MacOS 10.11.6 (El Capitan) - and both I'm having issues connecting to bitbucket.  Same errors reported by this user both for the oAuth as well as basic authentication.  I'm able to connect using the preferences/accounts - but when I tried to refresh the repo I get the errors.

Appreciate any help!

Hi, Can you please make sure the protocol for the account and your repo clone/remote URL are same?

If account is ssh, remote  URL should also be ssh and likewise with https. 

I would recommend using the latest version 2.7 (142) for your work. 

Thanks,
Manjunath

I am having the same issue... I cannot login to Bitbucket in Sourcetree to update my remote repositories. I am using 2.7 on MacOS High Sierra. I checked that the protocol is the same. I tried with OAuth and with the Basic Auth Type. Nothing seems to work. I can login just fine on BitBucket Cloud though, and double checked my username and password. Nothing works... Any help is appreciated.

Can you describe what is happening when you try to login and include any error messages, screenshots that might help us help you with this?

I was getting the same errors as Paul (post on Mar 07,2017). However, I just managed to fix it by changing my username on Bitbucket, by adding a few more characters to it, and then updating it in SourceTree. I found this suggestion in one of the replies above. Thanks!

I have the same exact issue.  

Has this been fixed yet?

I've reinstalled Sourcetree, cleared all caches, keychain credentials and am still unable to access my remote gits.

My error is " The operation couldn’t be completed. (com.google.HTTPStatus error 401.)"

Can you confirm the version of Sourcetree you have installed now?

This happens even with the most up to date versions of Sourcetree (It auto updates rather frequently): currently 2.7 (152)

That is my issue as well. Same thing

Same issue.  Just got my new mac book pro, installed latest version of source tree 2.7 (152), and no dice.

Same here. SourceTree 2.7

Exactly the same problem, it's very frustrating.

0 vote
jason I'm New Here Feb 09, 2018

Hi All, has anyone solve this issue? i'm having the same problem. 

As a workaround, when I was awaiting notification from our security team that my access was granted ...

I logged in to SourceTree with my google account.

Then I logged into my repo from within Sourcetree, and no issues.

I *was* having issues with direct bitbucket repo creds against sourcetree.

Since the initial success with my gmail to get into SourceTree, I am using my internal account as desired for all logins.

hope this helps.

My workaround was to downgrade SourceTree.  I went back to version 2.6.3 (build 134) and the problem went away.

Thanks, downgrading to 2.6.3 worked for me too. I'm done upgrading Sourctree. Too many times I've been burned by bad updates. If it works, don't upgrade.

0 vote
Bosen I'm New Here Mar 01, 2018

The issue is still there, i'm having the same problem. 
I feel frustrated. my sourcetree version is 2.7.1.

Thanks, that worked for me too. I'm done upgrading Sourctree. Too many times I've been burned by bad updates. If it works, don't upgrade.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

78 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you