Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Jira Cloud connection with API token failed, possibly due to unsupported Basic auth

Discussion in 'Unity Version Control' started by Wolfram, Mar 10, 2023.

  1. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    253
    Hi!
    We're trying to connect the PlasticSCM standalone client (11.0.16.7806) (on-premise server, not the Cloud edition) to our Jira Cloud.
    I've created an API token for my user account on the Jira page, according to your https://docs.plasticscm.com/extensi...ng-guide#Client-configuration-JIRA-Parameters , and the linked https://id.atlassian.com/manage-profile/security/api-tokens
    In Plastic, as "Host:" I added our main cloud url, as "User name:" the email address (=Jira account login), and as "Password:" I added the API token.

    However, when clicking "Test Connection", all I get is
    Test connection failed. Please review the entered values.

    and the Plastic client logfile says:

    2023-03-10 18:42:47,448 xxx\yyy ERROR jiraextensionrest - There was a problem performing GET https://zzz.atlassian.net/rest/api/3/status: The remote server returned an error: (401) Unauthorized.

    2023-03-10 18:42:47,449 xxx\yyy ERROR jiraextensionrest - Response from the server: Basic authentication with passwords is deprecated. For more information, see: https://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth/

    I tried this with both the
    /rest/api/2/
    default for "REST API:", and the apparently updated (=non-Basic auth?)
    /rest/api/3/
    , and always get the same error.

    The "great" thing is that the webpage this links to indeed confirms that Basic auth is no longer possible with REST, and they link to their API token documentation...which still uses a
    curl
    example that still uses Basic auth, and therefore also fails for the same reason... :facepalm:

    So how can we connect the Plastic client to Jira Cloud?

    Thanks!
    Cheers,
    Wolfram

    Jira_fail.png
     
  2. carlosalba1985

    carlosalba1985

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    842
  3. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    253
    Nope, their curl example is wrong, as it uses Basic auth, which Jira blocks:
    Output of the correctly configured curl command, according to their API page (identifying information redacted):
    curl_fail.png

    Can you confirm that your "many users configuring JIRA cloud with API token" are still able to do this with the regular PlasticSCM client?
    Please note that even in the screenshot from the Jira page you posted there is STILL the obsolete and incorrect documentation of Basic Auth:

    Jira_API_page_fail.png

    Please also note that Jira made an additional change for API tokens created after 2023/01/18, so there is the additional possibility that the Plastic client request sent to Jira does not take this into account:

    token_length_warning.png

    Which Auth mode except Basic does the current Jira API token system use? Their documentation page doesn't even say that.
     
  4. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    253
    @carlosalba1985 do you have any further advice on this?

    Cheers,
    Wolfram
     
  5. rednbrick

    rednbrick

    Unity Technologies

    Joined:
    Dec 22, 2021
    Posts:
    60
    Hi @Wolfram,
    I have tested with the latest version of Plastic SCM and the test connection has been completed successfully.
    Please create a support ticket with the Version Control team and attach the screenshots which show how you configured in preferences. I will help further with the ticket.
     
    Wolfram likes this.
  6. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    253
    Argh, I think I found the solution.

    First of all, for whatever reason, today I no longer get the 401 errors from Jira Cloud, despite using the exact same curl command. Also in Plastic, the "Test Connection" button still returns the error dialog posted above - but in the Plastic log there now is at least a valid certificate from Atlassian printed instead of the jiraextensionrest error mentioned above.
    => so my guess is, there really was a problem with the Jira Cloud server and/or connection that has been resolved by now, without me doing/changing anything.

    The actual problem however was, that when creating the API token I clicked the eye to reveal the token, and then used Ctrl-a to select all (and it does indeed highlight the (visible) portion of the token at this point), and Ctrl-c to copy the token to the clipboard. Which should be a surefire way to copy the token.
    However, it seems Jira's UI is faulty/buggy here, and it did NOT copy the complete token! :mad:

    I now created another API token, and I EXPLICITLY had to use the provided UI button "Copy to clipboard" - again, trying with Ctrl-a did NOT select the full token, only a part of it.
    So the fault was/is a badly programmed Jira webpage.
    Sheesh...

    Now authentication works, both with curl, and also from within the Plastic client, and I can connect our branches to Jira tickets... :)
     
    rednbrick likes this.
  7. carlosalba1985

    carlosalba1985

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    842
    Are you facing any authentication problems using an API token?
     
  8. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    253
    This comment has a strong spam/ad smell...
     
  9. carlosalba1985

    carlosalba1985

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    842
    Thanks for reporting it.