400 error during the request of an 0Auth 2.0 access token

Dear Atlassian Community,

I am developing an add-on (app) for Confluence Connect and I am following the steps of Request an OAuth 2.0 access token to get an access token and perform a request to the REST API on behalf of a user. To be more clear, this the diagram I am trying to achieve. The step where I am stuck is the one that says: “Response OAuth 2.0 access token”.

connect-servicecall-oauth2bearer

I am able to create the JWT assertion and to POST it to the Authorization Server. However, the response I keep getting from the server is a 400 error with the error_description of:

“No oauth client details found for https://{domain}.atlassian.net and oauthClientId {oauthCliendId}”.

I get this error running the sample JS program and also using some custom Python code I wrote. Surprisingly, I get the same error even when the app is not installed (running npm start) in the Confluence site.

To build the payload of the JWT, I copy the oauthClientId that is POSTed to the /installed endpoint during my app installation.

Is this the expected behaviour? Am I missing something regarding the request to the Authorization Server? Are the documentation and the sample JS program showing the current functionality of the Authorization Server? Is this server working correctly?

Is there anybody who has been able to perform a call to the Confluence Cloud REST API on behalf of a user, after getting an access token from the Atlassian Authorization Server?

Please, any help is very appreciated.

Many thanks and regards,

Asier

1 Like

There is an error in the documentation at OAuth 2.0 - JWT Bearer token authorization grant type, “Request an OAuth 2.0 access token” section. During the creation of the JWT assertion, the ‘tnt’ field should have a value like ‘https://{your-instance}.atlassian.net/wiki’, instead of the stated ‘https://{your-instance}.atlassian.net’. I have opened a PR.

2 Likes