Cannot login to custom jira site

Issue #483 open
Jonathan created an issue

I tried to “ADD CUSTOM JIRA SITE“ in the “JIRA“ tab, but got the following error:

Authentication error
Error authenticating with Jira: TypeError: Cannot read property '48x48' of undefined

I checked my username and password and they are all right. I checked the curl log and it shows

curl -X GET -H "User-Agent:atlascode/2.x axios/0.19.2" -H "X-Atlassian-Token:no-check" -H "Content-Type:application/json" -H "Authorization:Basic <REDACTED>" "https://jira.mycompany.com.au/rest/api/2/myself"

which included my custom domain that I entered in “Add Jira Site“ in the first step: https://jira.mycompany.com.au/ (it was also already added to my VS code trusted domain).

I tied to open the curled URL https://jira.mycompany.com.au/rest/api/2/myself in the browser, and got the following json response:

{
    "self": "https://jira.mycompany.com.au/rest/api/2/user?username=my_username",
    "key": "my_username",
    "name": "my_username",
    "emailAddress": "my_email",
    "avatarUrls": {
        "48x48": "https://jira.mycompany.com.au/secure/useravatar?ownerId=my_username&avatarId=14130",
        "24x24": "https://jira.mycompany.com.au/secure/useravatar?size=small&ownerId=my_username&avatarId=14130",
        "16x16": "https://jira.mycompany.com.au/secure/useravatar?size=xsmall&ownerId=my_username&avatarId=14130",
        "32x32": "https://jira.mycompany.com.au/secure/useravatar?size=medium&ownerId=my_username&avatarId=14130"
    },
    "displayName": "My Name",
    "active": true,
    "timeZone": "Australia/Sydney",
    "locale": "en_AU",
    "groups": {
        "size": 2,
        "items": []
    },
    "applicationRoles": {
        "size": 1,
        "items": []
    },
    "expand": "groups,applicationRoles"
}

Comments (15)

  1. Michel

    Same same in my case:

    We have a 2FA in place. Should that work?

    Would be great to get this VS Code Plugin running 🙂

  2. Nick Rundquist

    For help diagnosing could you try running curl -u <username>:<password> <bitbucket-server-address>/rest/api/2/myself from the command line and pasting the result here? You can redact any information you’re not comfortable with sharing, I’m just interested in the shape of the json in the response.

  3. Nick Rundquist

    Michel,

    Thank you for that. Maybe try adding the -L flag to follow the redirect. The http client we’re using should be following the redirect by default additionally the error message makes me think that we’re getting some data back, it’s just not quite what we expect.

  4. Michel

    Hi Nick

    Now there is another error “my.logout.php3?errorcode=19 HTTP/1.0“.

    I have to mention that the authentication is done with a 2FA mechanism using the regular Browser UI. When i try to connect with VS Code the 2FA is not triggered, i dont get the code request on my device.

    It seems to fail here https://username:password@extranetsso.company.com/my.policy

  5. Adam L

    @Nick Rundquist

    Sure !

    {"self":"https://myserver.com/rest/api/2/user?username=bobsmith","key":"bobsmith","name":"bobsmith","emailAddress":"Bob.Smith@myserver.com","avatarUrls":{"48x48":"https://myserver.com/secure/useravatar?ownerId=bobsmith&avatarId=11918","24x24":"https://myserver.com/secure/useravatar?size=small&ownerId=bobsmith&avatarId=11918","16x16":"https://myserver.com/secure/useravatar?size=xsmall&ownerId=bobsmith&avatarId=11918","32x32":"https://myserver.com/secure/useravatar?size=medium&ownerId=bobsmith&avatarId=11918"},"displayName":"Bob Smith","active":true,"timeZone":"America/Chicago","locale":"en_US","groups":{"size":22,"items":[]},"applicationRoles":{"size":1,"items":[]},"expand":"groups,applicationRoles"}
    

    update: Michel’s post should be redacted/removed asap

  6. Dan Bertolini

    I’m running into this same issue. I see the last response here was about a year ago. Was there ever a solution?

  7. Samir

    curl -X GET -H "User-Agent:atlascode/2.x axios/0.19.2" -H "X-Atlassian-Token:no-check" -H "Content-Type:application/json" -H "Authorization:Basic MY-ACCESS-TOKEN" "https://at.mycompany.com/bb/users/my_username/repos/rest/api/1.0/users/my_username?avatarSize=64"

    In case of Authorization: why we are not able to send bearer ?

  8. Log in to comment