Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Only apps can access this resource for connect app

I have a Spring Boot app that I created following the instructions here:

I am able to install that app in my Jira instance and I can see it working, meaning, I can see a Hello World being printed to the screen. I am now trying to use the same app to register for web-hooks:

HttpResponse<JsonNode> response ="https://<my_domain>")
.basicAuth("<my_email>", "<API_Token>")
.header("Accept", "application/json")
.header("Content-Type", "application/json")


However, I get the following error message in response:

"errorMessages": [
"Only apps can access this resource."
"errors": {}

I am following all the correct documentation as far as I know, so I am not sure what the issue is. This is clearly a connect app that I created using the documentation provided. I would really like to avoid to user OAuth if possible. Any help would be greatly appreciated!

1 answer

That request isn't actually being made as the app by the looks of it, you're using basic auth with an email address and token so from Jira's perspective it's just a request from your user account.

Check out the docs for the springboot sample:

They have a section "Making API Requests to the product as the add-on" which might be what you're looking for.

@Jared Kells Thank you for the response. I took a look at that section and I am doing exactly as it shows there, and it's still a no go, tbh I am kind of disappointed with the documentation, it is very poor and depending on where you look you get different info, anyway, rant over, here is what I am attempting to do:

atlassianHostRestClients.authenticatedAsAddon().postForObject("https://<my_host>/rest/api/2/webhook", myJson, String.class));

I get an HTTP 400 error saying the JSON is not valid, I don't know why as I am using the JSON specified here. 

I also see in the documentation that the above is deprecated, so I am now trying to use:

atlassianHostRestClients.authenticatedAsAddon(AddonAuthenticationType.OAUTH2).postForObject("https://<my_host>/rest/api/2/webhook", myJson, String.class));

With the above I get:

401 Unauthorized: "{"message":"Client must be authenticated to access this resource.","status-code":401}"

which makes sense since I am not doing anything to authenticate. The question is, how do I authenticate? I have not found a single example to follow. 

What I am trying to do is pretty basic, using atlassian-connect-spring-boot I want to register for web hook, that is all I am trying to do, are there valid examples anywhere? 


Thank you in advance!

One thing that stands out to me from your example is that you have an absolute URL and you're using AddonAuthenticationType.OAUTH2


Taking a look at the docs, using absolute URLs deprecated and that authentication type is for Connect on Forge apps. Is that the sort of app you're building?

Normally you would register for webhooks in an application lifecycle event such as AddonInstalledEvent and you would use a relative URL which will automatically go to the correct host.

Is this code running in a lifecycle event?

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events