Unable to configure authentication for Jira

Issue #202 resolved
Gabriel Knauth created an issue

After the last upgrade for Atlassian for VSCode, my Jira integration stopped working.

I have uninstalled and reinstalled Atlassign for VSCode, and attempted both the Login to Jira Cloudand Add Custom Jira Site (even though it is the cloud edition).

After I click Accept on theAltascode Integrationpage, I receive an error Something went wrong(screenshots attached).

Software Details:

  • My operating system is Windows 8.1 Enterprise.
  • I am using version 1.38.1 of Visio Studio Code.
  • I have version 2.0.0 of theJira and Bitbucket (Official) extension installed.

Comments (27)

  1. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth Can you please try this:

    1. Go into the Atlassian Settings page and delete all Jira and Bitbucket sites you’ve authenticated with
    2. Open up your keychain manager and look for any entries that start with “atlascode-” and just delete them
    3. restart vscode
    4. re-authenticate with Jira using the Login to Jira cloud button.

    If that works, then it was a bad migration and we might be able to add and “eject” command to make this easier to deal with

  2. Gabriel Knauth reporter

    No luck, I’m afraid.  I’ve:

    • Removed all the Atlassian Settings
    • Removed all the atlascode- entries from Credential Manager
    • Restarted VS Code
    • Attempt to Authenticate Jira

    After which I:

    • Uninstalled Altassian for VSCode
    • Restarted VS Code
    • Reinstalled Atlassian for VSCode
    • Restarted VS Code
    • Attempted to authenticate again

  3. Jonathan Doklovic Account Deactivated

    Hmmm. that’s strange. But I should let you know that there’s no reason to uninstall/reinstall any vscode extension because vscode doesn’t give extensions a way to clean up anything during uninstall, so all json settings, keychain entries and global storage for any extension will remain there even after uninstall. This is why it’s a bit difficult to figure out what’s going on here.

    Do you get the same “Something went wrong” screen when you auth after clearing that data? Also, there’s definitely a bug in that screen where it’s reporting [object Object] instead of an actual error message. I’m thinking I might be able to cut you a version tomorrow which shows the actual error and that may help us figure out what the problem is. (if you can wait that long)

  4. Gabriel Knauth reporter

    Yes, exactly the same - I’ll upload a new screenshot.  I’m happy to wait, it’s Friday afternoon here, and we have a public holiday on Monday.

    Silly question, would PROXY settings have anything to do with it?  I run into all sorts of issues due to proxies.

  5. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth We’ve just released version 2.0.1. This probably won’t fix the issue but it should at least give you a proper error message. Can you try again with this version?

    Also, using a proxy could definitely be causing issues, but let’s see what the actual error is.

  6. Gabriel Knauth reporter

    Something went wrong

    Error authenticating with jiracloud: Error: socket hang up
    Give it a moment and try again.

  7. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth Do you know what proxy and/or proxy settings you use? You mentioned you may be going through a proxy. Is this for all http connections?

  8. Gabriel Knauth reporter

    Yes, I know what the proxy settings should be.  I have to use them for both HTTP and HTTPS connections.  I have set them up as environment variables in Windows, which works 95% of the time.

  9. Jonathan Doklovic Account Deactivated

    Does your proxy require auth? If so, is it basic auth or something else?

    I’ve tested locally with a squid proxy (no auth) and it seems to work, so I’m just trying to figure out where the issue is

  10. Gabriel Knauth reporter

    No auth. I think the proxy is working ok because I was able to install the extension in the first place.

    When I click ‘Accept' on the authorisation form, I’m redirected to http://127.0.0.1:31415, which I cannot ping. I can, however ping 127.0.0.1.

  11. Jonathan Doklovic Account Deactivated

    Hi @Gabriel Knauth

    We just release 2.1.0 which has some fixes which may or may not resolve your issue and we’ve added even more detail in the error messages. Can you please try again with this version and let me know how it goes?

  12. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth Thanks for testing so quickly. At least now we know what part of the OAuth flow is failing. Basically, it takes you to the auth page, you complete the auth, and it successfully redirects back to the localhost handler. At that point, the first external request (via your proxy) is made to do the token exchange and that’s what’s failing.

    Could you run the following cUrl command in a terminal and see what it gives you back? It’s effectively the same request the extension is making. I expect it to return an Unauthorized response. I want to see if it does that or if it returns the socket error.

    curl -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: application/json' -H 'User-Agent: axios/0.19.0' -H 'Host: auth.atlassian.com' --data-binary '{"grant_type":"authorization_code","client_id":"aclientid","client_secret":"asecret","code":"acode","redirect_uri":"http://127.0.0.1:31415/jiracloud"}' --compressed 'https://auth.atlassian.com/oauth/token'
    

    Thanks!

  13. Gabriel Knauth reporter

    @{557057:3695b794-cde3-43a2-99aa-c0fc6151b754} You’re right - an Unauthorised response.

    $ curl -H 'Accept: application/json, text/plain, /' -H 'Content-Type: application/json' -H 'User-Agent: axios/0.19.0' -H 'Host: auth.atlassian.com' --data-binary '{"grant_type":"authorization_code","client_id":"aclientid","client_secret":"asecret","code":"acode","redirect_uri":"http://127.0.0.1:31415/jiracloud"}' --compressed 'https://auth.atlassian.com/oauth/token'
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 210 100 60 100 150 60 151 0:00:01 --:--:-- 0:00:01 211{"error":"access_denied","error_description":"Unauthorized"}

  14. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth hmmm. that’s unfortunate. I assume curl commands also go through your proxy, but just for kicks could you do:

    export https_proxy=https://your.proxy.server:port/
    curl -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: application/json' -H 'User-Agent: axios/0.19.0' -H 'Host: auth.atlassian.com' --data-binary '{"grant_type":"authorization_code","client_id":"aclientid","client_secret":"asecret","code":"acode","redirect_uri":"http://127.0.0.1:31415/jiracloud"}' --compressed 'https://auth.atlassian.com/oauth/token'
    

  15. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth Sorry, but I really want to make sure it’s doing what we think it’s doing…

    Could you run that again and add the -v flag? e.g. curl -v …

    And if you could scrub the log, but point out where it’s hitting the proxy with an arrow or something that would be helpful.

    After this, I’m going to have to do some more thinking 🙂

  16. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth OK, I’ve created a new version that forces the proxy in our client if it finds it in the nodejs environment.

    You’ll need to manually install from the extensions panel menu option “Install from vsix…”

    https://bitbucket.org/atlassianlabs/atlascode/downloads/atlascode-2.1.1-forceproxy2.vsix

    In theory this should force our axios client to go through the proxy.

    It should tell you if it finds the proxy or not in the debug console or the output console.

    Note: if this does indeed work, we’re not out of the weeds yet as I’ve only put it in the auth flow and not all of the requests needed to actually operate.

    🤞 let me know how it goes.

  17. Gabriel Knauth reporter

    I installed the new version, but it doesn’t show anything in the Output or Debug Console tabs.

  18. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth First of all, thanks for hanging in there and putting up with all of this madness! We’re getting closer to solving this. The problem is that I cannot for the life of me recreate the socket hangup error on my side.

    Give me a bit and I’ll have something for testing tomorrow.

    Thanks again!

  19. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth I’ve created a new version that allows you to tunnel https to your http proxy. Here’s what I’d like you to do:

    1. download the visix file (link below) and install it using the “Install From visix…” option in the extension panel menu
    2. from the command palette open “Preferences:Open Settings (UI)”
    3. on the settings screen search for “output level”
    4. find “Atlascode: Output Level” and change it to be “debug”
    5. Search again for “Tunnel”
    6. find “Atlascode: Enable Https Tunnel” and check it
    7. Switch to the Output tab at the bottom of VS Code
    8. Using the dropdown on the right, select “Atlassian”
    9. open the Atlassian Settings screen
    10. try to login

    After you go through the auth flow (which may or may not work), you should have logs in your output window from our extension. Could you let me know what those are?

    https://bitbucket.org/atlassianlabs/atlascode/downloads/atlascode-2.1.1-tunnel2.vsix

    Thanks!

  20. Gabriel Knauth reporter

    @{557057:3695b794-cde3-43a2-99aa-c0fc6151b754} Woo Hoo!!! 😊

    [2019-10-10 21:56:11:473] auth server on port 31415 has been shutdown
    [2019-10-10 21:56:11:487] auth server started on port 31415
    [2019-10-10 21:56:25:234] using proxy: my.proxy.server.com:portnum
    [2019-10-10 21:56:26:834] auth server on port 31415 has been shutdown
    [2019-10-10 21:56:31:761] Online check attempting to connect to http://atlassian.com
    [2019-10-10 21:56:31:762] Online check attempting to connect to https://bitbucket.org
    [2019-10-10 21:56:32:598] Online check connected to http://atlassian.com
    [2019-10-10 21:56:33:086] Online check connected to https://bitbucket.org
    

    Will I raise a different Issue number for not being able to log in to a Custom Bitbucket Site?

  21. Jonathan Doklovic Account Deactivated

    @Gabriel Knauth Awesome! Thanks so much! I’m so glad we got it working.

    Please raise a separate issue for the Bitbucket custom login. I’m going to resolve this one (finally).

    Expect to see a proper release of this in the next few days. You won’t need to do anything special once it’s released.

  22. Log in to comment