Confluence Cloud : atlassianClient.authenticatedAsHostActor() empty oauthClientId

Hello, Community,

using atlassian-connect-spring-boot I am trying to configure sending REST requests to Confluence Cloud on behalf of a host user. Here is sample request:

User user = atlassianHostRestClients.authenticatedAsHostUser().getForObject("/rest/api/user/current", User.class);

this request fails in OAuth2RestTemplateFactory’s

assertValidHostUser(hostUser); // (line 44)

as the matching AtlassianHostUser object has null oauthClientId.
atlassianHostRestClients.authenticatedAsAddon() works fine and requests are processed.
ACT_AS_USER scope exists in atlassian-connect.json.

Could you, please advise how to make oauthClientId be not empty?

Thanks.

Can you please paste your descriptor here as well?

Here is the descriptor (clicking on editing the macro calls my service method which performs a REST service call):

{
  "key": "my-addon",
  "baseUrl": "http://localhost:8080",
  "name": "My Custom Addon",
  "authentication": { "type": "jwt" },
  "lifecycle": {
    "installed": "/installed",
    "uninstalled": "/uninstalled"
  },
  "scopes": ["READ", "WRITE", "ACT_AS_USER"],
  "modules":
	{
	    "dynamicContentMacros": [
	      {
	      	"key": "link1",
	        "name": { "value": "Link1" },
	        "url": "/link1",
	        "description": { "value": "Generates a link1." },
	        "outputType": "block",
	        "bodyType": "none",
	        "editor": {
	            "insertTitle": {"value": "Insert title"},
	            "editTitle": {"value": "Edit title"},
	            "width": "300px",
	            "height": "200px",
				"url": "/callConfluenceRestService"
	        }
	      }
	    ]
  	}
}

Thanks.

@rmassaioli,

authenticatedAsHostUser started to work when I reinstalled the plugih, repackaged the Add-on etc.

Thanks for taking a look at it!

1 Like