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 Mar 14, 2019 in Jira

Updates to jira.atlassian.com give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

584 views 1 15
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