Cannot setup SourceTree, stuck at OAuth authorization
Asked by Seadna Smallwood:

I started SourceTree today and was asked for my credentials. I entered them and it brought me to the OAuth authorization page but there is an error:
> Invalid redirect_uri
>
> This integration is misconfigured. Contact the vendor for assistance.

So i did a full, clean install of the latest version of SourceTree and now I cannot complete the setup process as it is stuck at the OAuth authorization page with the same error as above. I need this working ASAP so any help is highly appreciated!


Answers:
author: Seadna Smallwood
body: I found a way to get SSH method working:

1. Uninstall SourceTree and delete the Atlassian and Sourcetree folders from AppData\\Local.
2. Copy the Atlassian and Sourcetree folders from AppData\\Local on a PC where SourceTree is installed and working fine to your PC.
3. Run the SourceTree installer, it should just open up SourceTree.
4. Click Tools -\> Create or Import SSH Keys
5. Click generate and follow the instructions to move mouse around.
6. Enter a passphrase and save the public and private keys. Copy the text from the public key in the PuTTY key generator window.
7. Open Bitbucket and open your account settings, go to SSH and paste in the public key that you copied from the PuTTY key generator window.
8. You will need to change the URL to use the new SSH format. This guide shows how to do it: <https://confluence.atlassian.com/bitbucket/change-the-remote-url-to-your-repository-794212774.html>
9. Restart sourcetree and try fetch, first try might give error but second try worked fine for me.

Hope this helps someone.

comments: author: Seadna Smallwood
body: Also, I recommend everybody to use SSH instead of HTTPS as a preventative measure.


author: Vadim Tofan
body: [@Seadna Smallwood](/t5/user/viewprofilepage/user-id/1742467) Thanks, your solution worked for me. The last step didn't work well, after several Sourcetree restarts, the workaround was to close source tree, open an existent repository and edit the file \~\\.hg\\hgrc. Under \[paths\] replace the default OAuth link with the SSH link from bitbucket repository URL


author: Seadna Smallwood
body: [@Vadim Tofan](/t5/user/viewprofilepage/user-id/2276680) thanks for pointing that out! I did this also but forgot to put it in the list! I'll edit my post now.


author: Mikael Sandberg
body: This is a known issue and has to do with OAuth, the Bitbucket team is aware of it and are actively working to resolve it. Check [https://bitbucket.status.atlassian.com](https://bitbucket.status.atlassian.com/) for more information.

comments: author: Seadna Smallwood
body: Awesome!


author: Jimmy Seddon
body: Hi [@Seadna Smallwood](/t5/user/viewprofilepage/user-id/1742467),

It looks like you might be running into this:

<https://jira.atlassian.com/browse/SRCTREEWIN-10965>

While there isn't a posted solution for it yet, you might want to go vote, watch and comment on that issue.

Sorry I can't offer more help.

-James

comments: author: Seadna Smallwood
body: Thanks, I voted on it. Will comment now.


author: Seadna Smallwood
body: Sorry i thought it was this bug: <https://jira.atlassian.com/browse/SRCTREEWIN-11942?jql=project%20IN%20(SRCTREE%2C%20%20SRCTREEWIN)%20AND%20type%20%3D%20Bug%20AND%20statusCategory%20!%3D%20Done%20ORDER%20BY%20Updated>


author: Jimmy Seddon
body: [@Seadna Smallwood](/t5/user/viewprofilepage/user-id/1742467) - You might be right! That or they are essentially the same thing but no one has investigated to see if they are the same root problem.


author: Seadna Smallwood
body: Yes neither issue has been assigned yet. I linked them as i think they are the same.


author: Seadna Smallwood
body: I managed to get sourcetree running on my PC but still cannot fetch or pull. I have a laptop where it is running fine, I copied the Atlassian and Sourcetree folders from AppData\\Local on my laptop to the same location on my PC. I then ran the installer again and SourceTree opened.

I cannot fetch however as it still asks for credentials and brings me to the Invalid redirect_uri error page.


author: Seadna Smallwood
body: Sorry when I say 'running fine' i mean that I don't have the OAuth/redirect issue.


author: Seadna Smallwood
body: So the issue is tied to the specific computer. I wonder is there a reg key that can be cleared or something. Or is there another location that I don't know about where is something that can be deleted.


author: Marek
body: Hi,

I have the same problem.

I installed sourcetree and registered bitbucket on one computer (with windows 10)

after that I tried install sourcetree on second computer (with windows 7) but it is no able to pass second step - registration,

when I click bitbucket web broswer opens new page with information "Authentication Successful"

but install stay in registration page.

I copied Atlasian and sourcetree directories from 1'st computer but stil the same...


author: Vadim Tofan
body: I have the same issue

comments: author: Seadna Smallwood
body: This is very frustrating that there is no solution for this!


author: Vadim Tofan
body: My workaround was to clone the repository into another folder. hope this helps you too. EDIT: this worked temporarely


Tags: administration

bug

oauth

redirect