Forums

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

Impersonate a user request to REST API CALL

Rakesh15 May 8, 2020

Could you please let me know,  how can I access JIRA Rest API by impersonating a user request. A request from user should go to a service. Service should use admin rights to access API and fetch the details. 

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2020

There is no impersonation function.

Rakesh15 May 8, 2020

I am trying to achieve something like below.but failing. Please guide me. 

 

Let's say User submits a request to create an issue in jira board. Since user doesn't have account in jira. I want to create a rest api which will receive the users request and then uses admin credentials and make a request to jira rest api to create an issue. This is what I am trying to achieve. 

However, I am facing problems here. I have admin account in jira. When I login in browser I can see JSessionId. Now when I am passing my user name or email Id with password (which is my windows password) basic authencarion is failing. 

Could you please be do kind to help me. 

Rakesh15 May 8, 2020

@Nic Brough -Adaptavist- could please guide me on this. 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2020

You need to decide who to log in as, and use that account (you'll lose the informaiton about who is raising it, of course, but at least you'll get something)

Your JSession is useless unless you've got SSO enabled.

Rakesh15 May 8, 2020

I have admin account in organization jira cloud. We also have pki implementation for end users. So end users need to do oauth authencation to login after logging in they can fill details and submit a post request to create an issue. 

Now this request will reach rest api where we will use my admin account to create issue in jira.

It is still fine if we lose information about who raised the issue. 

 

But the issue is I am unable to achieve what I explained above. Please be so kind to let me how can I Achieve this. 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 9, 2020

To do what you have described above, you will need who to decide who to log in as, and use that account to make the REST calls.

Rakesh15 May 9, 2020

I am sorry but this statement is not that clear to me. Lets say u have made a request to Rest API which I have hosted in my server. Once the API receives your request, it will create actual URL to hit JIRA and a token based on my identity (since mine is admin account).

So, now how can I create an access token in rest API after receiving the request from you.  Because for creating an access token I need my smart card.

I hope I am not confusing you. Please excuse me.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 9, 2020

>how can I create an access token in rest API after receiving the request from you

You will need to use the method detailed in the REST API docs.  However, there's a far better description of what you need to do in Andrew's answer over at https://community.atlassian.com/t5/Jira-questions/How-to-authenticate-to-Jira-REST-API/qaq-p/814987

Rakesh15 May 9, 2020

Thank you Very much for that. I will try these ways. For now I am accepting as this really really helped me. If I face any issues in achieving this I will raise a new question. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events