Jira Authentication failure, negative seconds remaining for auth token

Issue #683 new
Ian Chamberlain created an issue

Reproduced with all other extensions disabled:

VSCode Version: 1.63.2

Extension details:

Atlassian version: Name: Jira and Bitbucket (Atlassian Labs)
Id: atlassian.atlascode
Description: Bringing the power of Jira and Bitbucket to VS Code - With Atlassian for VS Code you can create and view issues, start work on issues, create pull requests, do code reviews, start builds, get build statuses and more!
Version: 2.10.3
Publisher: Atlassian
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=Atlassian.atlascode

It seems like in 2.10.2 / 2.10.3 there were some changes related to Jira Authentication, and I can no longer see issues under my Jira filter view. Opening the Atlassian settings page shows a failure to get a token:

Screen Shot 2022-01-14 at 10.57.31 AM.png Relevant debug logs in the output when this occurs (site ID redacted):

[2022-01-14 15:49:56:531] -2407561 seconds remaining for auth token. 
[2022-01-14 15:49:56:531] Need new auth token. 
[2022-01-14 15:49:56:531] Checking to see if we're the ruling pid 
[2022-01-14 15:49:56:531] Starting round 0 of negotiations 
[2022-01-14 15:49:56:531] This process is in charge of refreshing credentials. 
[2022-01-14 15:49:56:531] Ruling pid? true 
[2022-01-14 15:49:56:531] Refreshing credentials. 
[2022-01-14 15:49:56:531] refreshingAccessToken for https://api.atlassian.com/ex/jira/${site_id}/rest 
[2022-01-14 15:49:56:531] Starting token refresh 
[2022-01-14 15:49:56:738] error refreshing token Error: Request failed with status code 403 
[2022-01-14 15:49:56:738] Failed to refresh tokens  cannot get client for: Jira ... Error: Request failed with status code 403
[2022-01-14 15:49:56:738]  Error: JQL fetch error: cannot get client for: Jira ... Error: Request failed with status code 403

The large negative number on the seconds remaining message seems like a possible origin of the bug...

Comments (15)

  1. Nick Rundquist

    2.10.0 was an update to accommodate rotating refresh tokens. 2.10.2 was to fix some regressions that introduced (2.10.3 was just to fix an issue with logging). I noticed on the missing pr comment issue you’d been testing with pre-2.10.2 versions of the client, were you doing that before or after you noticed this? It’s possible that an earlier version failed to refresh the tokens properly and you only noticed on 2.10.3.

  2. Ian Chamberlain Account Deactivated reporter

    Yeah, actually I downgraded to 2.10.0 and it also reproduces this issue (with different logging, as you mentioned). So probably this was introduced in 2.10.0

  3. Ian Chamberlain Account Deactivated reporter

    As another note, I tried re-authenticating the extension with my org's Jira instance from the settings page, but it appeared to have no effect.

  4. Adrián Martín Ramos

    Hello, experiencing the same error…

    Vscode version: 1.63.2

    Extension: Jira and Bitbucket (Atlassian Labs)v2.10.3

    Something went wrong

    cannot get client for: Jira ... Error: Request failed with status code 403

  5. Nick Rundquist

    Clearly there’s still a bug in my token refreshing code. I’m working on getting this fixed ASAP.

  6. Nick Rundquist

    I’ve just release 2.10.4 which should fix this. You’ll need to log in one more time but after that it should work.

  7. Jay Johnson

    Looks good with the update. Thanks for the quick fix. This is one of my favorite VSCode extensions, great work.

  8. Nick Rundquist

    For those of you still having trouble getting logged out on a regular basis I'm still working on tracking the issue down.

    Things to try if you haven't already:

    • Log out of the affected account (click the trash can icon on the right side of the accounts entry in the settings for the account) before logging back in.

    If you're still having trouble there are a few questions I have to help track down why exactly this is still failing:

    1. Are the failures in Jira, Bitbucket, or both?
    2. Do you have multiple Atlassian accounts authenticated or have Server accounts authenticated in addition to Cloud accounts?
    3. When authentication is failing do you have multiple windows / workspaces open?

    If you want to help even more I've added some additional logging that should help narrow down what's happening.

    Enabling logging

    • Open the settings for VS Code and search "output level", there will probably be a few results, one of them should be "Atlassian" in the "Extensions" section.
    • Set the output level to "debug".
    • If you don’t already have a terminal open in VS Code, select New Terminal from the Terminal menu.
    • Select the "Output" tab in the terminal.
    • Select "Atlassian" from the dropdown at the right.

    Specifically, when you get logged out look for the window that logs that include the messages "Is responsible process: true" "Refreshing credentials." and see if there are any errors logged around that event.

  9. Jörg von Frantzius

    Workaround for me was to disable the Jira integration, enable it again and then logging in again

  10. Käen Studio

    2.10.12 same problem. Bitbucket doesn't work for me. It is interesting that the problem is only on the laptop. Everything works great on the computer.

  11. Log in to comment