Equivalent of api.asApp().requestJira with UI Kit2


With UI Kit 2 we don’t use api.asUser or api.asApp anymore with requestJira.
My problem is that if my app calls

const res = await requestJira('/rest/api/3/role');

it tells a standard user that he doesn’t have the right permissions, because the /role API needs Jira administration rights.
How to make the call with the permissions of the app instead of the permissions of the user?
Thanks for your help!

Hi @BertrandDrouhard1
Please see the API doc of get all project roles:

OAuth 2.0 scopes required:
Granular:read:user:jira, read:group:jira, read:project-role:jira, read:project:jira, read:avatar:jira, read:project-category:jira(Show less)

We need to add those scopes to the manifest file. Hope it helps.

Hi @BertrandDrouhard1, you can only make asUser() calls from the front-end. If you want to make asApp() calls you need to do so from a back-end resolver. This is one of the differences from UI Kit 1, now the UI Kit 2 runs client side.


Thanks @YY1 :slightly_smiling_face: , I had the right scope in the manifest file, my problem was that a “asApp” call must be made from a resolver as @AdamMoore said.

Thank you Adam, I understand :+1: It is still not very clear for me what should be done on the back-end and what should be done on the front-end. I have to try to find a good tutorial on React apps architecture.

1 Like

Yeah apologies, our user interface docs are a bit of a mess at the moment. UI Kit 2 will go GA soon and we’ll take the chance to simplify things a bit. Both UI frameworks will be client side, use the Forge bridge etc.