Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use current user to run api calls on postfunction?

Gagan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 7, 2022

Hi Team,

Im trying run an api call from the postfunction to get fields data. but the downside is we cant use the hard coded / basic auth due too restrictions. can we make use of current user to run the API.

1 answer

0 votes
Pramodh M
Community Champion
January 7, 2022

Hi @Gagan 

Use ComponentAccessor to get logged in user and IssueManager to perform any activity on Issue using that user who is performing either transition or any relevant action.

https://community.atlassian.com/t5/Jira-questions/How-to-get-current-user-in-jira-application/qaq-p/818002

Thanks,
Pramodh

Gagan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 7, 2022

Hello @Pramodh M ,

i need to get the json of the fields data (like type etc) which we get from /rest/api/2/field.

But to do so it needs authentication and for the auth i need to make use current user. as this call is run by admins only.

i cannot hard code the creds to the code.

Suggest an answer

Log in or Sign up to answer