[ac-play-java] Request from add-on server to JIRA rest ends up with Unauthorized (403)

215 views
Skip to first unread message

Alan Alfredo Rojas Marroquin

unread,
Oct 9, 2014, 1:46:06 PM10/9/14
to atlassian-...@googlegroups.com
Hi, 

I am trying to make PUT request to JIRA's /rest/api/2/mypreferences?key=access_token from ac-play-java-based addon as follows:

AC.url("/rest/api/2/mypreferences").setQueryParameter("key","access_token").put("some value")

But I get the status 403 (Forbidden)

2014-10-09 12:12:13,576 http-bio-2990-exec-74 WARN anonymous 732x49773x1 - 127.0.0.1 /rest/api/2/mypreferences [plugin.module.permission.ApiScopingFilter] Request not in an authorized API scope from add-on 'com.test.addon' as user 'addon_com.test.addon' on URL 'PUT /jira/rest/api/2/mypreferences

For an initial test I only used Read/Write scopes then  I'm put all scopes. Both tests get same response status 403 :/

     "scopes": ["read","write","delete","admin","project_admin"]

My Addon User belongs to all groups.

What am I doing wrong?

Thanks for all

Regards,
alrojas

Alan Alfredo Rojas Marroquin

unread,
Oct 9, 2014, 1:51:00 PM10/9/14
to atlassian-...@googlegroups.com
Jira started with:

atlas-run-standalone --product jira --version 6.4-OD-05-009 --bundled-plugins com.atlassian.jwt:jwt-plugin:1.1.0,com.atlassian.bundles:json-schema-validator-atlassian-bundle:1.0.4,com.atlassian.webhooks:atlassian-webhooks-plugin:1.0.6,com.atlassian.upm:atlassian-universal-plugin-manager-plugin:2.17.14-D20140902T224549,com.atlassian.plugins:atlassian-connect-plugin:1.1.4 --jvmargs -Datlassian.upm.on.demand=true

Travis Smith

unread,
Oct 9, 2014, 2:56:07 PM10/9/14
to atlassian-...@googlegroups.com
If you look at the JIRA scopes document in the Connect docs (https://developer.atlassian.com/static/connect/docs/scopes/jira-rest-scopes.html) you'll see that the /rest/api/2/mypreferences isn't in the list. This REST endpoint isn't exposed via Connect. You won't be able to use that API at this time. 

Cheers,

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-Travis


--
-Travis

Daniel Wester

unread,
Oct 9, 2014, 6:45:06 PM10/9/14
to atlassian-...@googlegroups.com
What are you trying to do? Maybe there's another way...
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-Travis


--
-Travis

Alan Alfredo Rojas Marroquin

unread,
Oct 9, 2014, 7:31:37 PM10/9/14
to atlassian-...@googlegroups.com
I wanted to save some configuration values. I think I'll do it using some database. XD
Or What Do you suggest?

Thanks to both for answer.

Travis Smith

unread,
Oct 9, 2014, 7:33:29 PM10/9/14
to atlassian-...@googlegroups.com
If it's issue or project specific you can use entity properties. If it's more general stuff, you'll need to use something in your add-on - like a database. 

To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-Travis
Reply all
Reply to author
Forward
0 new messages