Forbidden (403) when trying to access /rest/api/1.0/search with atlassian connect express

I am trying to follow the examples for atlassian connect express

...
	"scopes": ["READ"],
	"modules": {
	"generalPages": [
	{
		"key": "activity-page-jira",
		"location": "system.top.navigation.bar",
		"name": {
			"value": "test activity"
		},
		"url": "/test-activity",
		"conditions": [{"condition": "user_is_logged_in"}]
...

JS-Code in index.js

...
app.get('/test-activity', addon.authenticate(), function (req, res) {
	var httpClient = addon.httpClient(req);
	httpClient.get('/rest/api/1.0/search', function(err, res, body) {
		console.log(res);
	});
	...
}
...

Error in JIRA log:

 Request not in an authorized API scope from add-on

 

 

2 answers

The error message is a bit misleading. Figured it out 5 min after posting the question. Leaving it here for reference.

Turns out the version of the service was wrong. Works with 

/rest/api/latest/search

Make sure to double check the list here for version and call you want to use:

https://developer.atlassian.com/static/connect/docs/scopes/jira-rest-scopes.html

Also note that only the API that is included in the list of JIRA / Confluence scopes is exposed for Connect addons: https://developer.atlassian.com/static/connect/docs/latest/scopes/jira-rest-scopes.html

So I am getting a 403 on /rest/webhooks/1.0/webhook API (on "latest" too), and looks like it is the way it is supposed to work—even though a direct request via CURL works fine.

I gathered this information from several responses in the Google Group for Atlassian-Connect-Dev, for example: https://groups.google.com/forum/#!searchin/atlassian-connect-dev/addon$20scope/atlassian-connect-dev/SYRXJo1SyDo/9Z6v8ndwclEJ

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,294 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you