@forge/bridge requestJira() fails with "An unexpected error occurred when fetching an auth token"

Hi,

I’m currently testing migration of a Connect app to Forge, and after installing the forge version from the DEVELOPMENT environment, the @forge/bridge requestJira() method does not work. It returns the “An unexpected error occurred when fetching an auth token”, and the GraphQL request to retrieve the token returns

"data": {
        "userAuthTokenForExtension": {
            "success": false,
            "errors": [
                {
                    "message": "No Atlassian OAuth token found for this user and extension"
                }
            ],
            "authToken": null
        }
    },

These errors were previously documented here on CDAC but the workaround proposed by @XavierCaron doesn’t seem to work anymore.

It is the same workaround also discussed by @AdamMoore in this similar thread where he mentions that it is resolved by de-authing and re-authing. However I cannot seem to find where I need can de-auth and re-auth the app?

I’m also a bit concerned given that I rather not require all end-users to have to go through de-authing and re-authing after they upgraded from Connect to Forge.

Any tips on how I can get this working?

I had something similar just the other day, where I simply did a asUser().requestConfluence() and got a somewhat similar unauthorized error.

In my case the correct permission scopes were missing. What helped the most was “forge lint” which pointed out which scopes were missing. And then on staging you need to run through the full re-verify consent stuff. Then it worked.

It says everything is a-OK!

remie@MacBook-Air-2 forge % forge lint

The linter checks the app code for known errors. Warnings are issues you should fix, but they won’t stop the app code from building.

Press Ctrl+C to cancel.

No issues found.

“MacBook-Air-2” you need to get a M5Pro to make it work :rofl:

You were right, it was indeed a permissions problem! Thanks :folded_hands:t2: