Getting the current user from Jira Cloud

Shahryar January 11, 2021

Hi everyone,
I want to get the information about the current logged-in user of the Jira cloud addon.
the docs suggested the /myself endpoint for this situation, but the problem is this endpoint only returns the information about the user who it's api_token is used in the app, not the user who is logged-in to the app via his/hers dashboard.

How can I do this?

 

thank you in advance

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 12, 2021

Hi Shahryar,

I understand you are creating an app for Jira Cloud.  However authentication is done differently depending on what exactly you are building.  From the way you have described this, it sounds like you're using basic auth.  If that is the case, your app can then only authenticate as the user that has supplied their API token to your app. 

Please take a look over at https://developer.atlassian.com/cloud/jira/platform/security-overview/ It explains the different methods of managing authentication depending on the type of app you are creating.  To meet your needs here, you will likely need to implement OAuth 2.0 in your app (provided this is not a Forge or Connect app, those frameworks have other existing means to manage this).  More details on that method can be found over in https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/ .

I hope this helps.

Andy

Shahryar January 12, 2021

Thank you very much for your response.

I'm using ACE actually, Can I use OAuth 2.0 with it?

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 13, 2021

Ah, in that case, please see Security for Connect apps.  For Connect apps, you can use two different forms of Authorization: Authorization via scopes and app users or Authorization with user impersonation.  The latter form does use a JWT bearer token which uses OAuth 2.0.  More details on that over in User impersonation for Connect apps.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events