I have successfully gotten the JIRA Oauth rest demo working, and I can query issues, and have also created a remote link by adding the changes in this answer
https://answers.atlassian.com/questions/51273/modifying-the-rest-oauth-example-to-include-a-json-body-in-the-request">https://answers.atlassian.com/questions/51273/modifying-the-rest-oauth-example-to-include-a-json-body-in-the-request
The problem I am having is I cannot find anywhere in the documentation or tutorial how to specify the user for 2-legged oauth authentication.
Is anyone able to point me in the right direction for specifying the user when making updates?
Thanks
Community moderators have prevented the ability to post new answers.
I've now been able to get this working using the Jira Java Rest Client, if you're using another client it should be easy enough to apply the same solution. Here's a link to my solution: https://answers.atlassian.com/questions/263719/using-oauth-and-the-jira-java-rest-client?page=1#288617
What you need to do is:
I am unable to process the user impersonate with the user_id parameter. Below is the code which I have.
OAuthConsumer consumer = new OAuthConsumer(callback, consumerKey, null, serviceProvider);
consumer.setProperty(RSA_SHA1.PRIVATE_KEY, privateKey);
consumer.setProperty(OAuth.OAUTH_SIGNATURE_METHOD, OAuth.RSA_SHA1);
consumer.setProperty("user_id", "userB");
I tried with "user_id" but not able to create the issues with the userB username.
Can you please provide me the solution how we can do user impersonate while creating/updating issues.
How I can specify the user when making updates on the issues.
Thanks you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Harinath T this used to work, but since ~7.5.0 or some such, it doesn't any more. Not sure what is the cause for this, but Jira no longer seems to accept an empty oauth_token and the user_id parameter is not regarded.
I think there may be a new config option for 2 legged impersonation for oauth that might have been introduced (not sure yet, I'm still investigating this myself right now, as what we had stopped working when I had to replace an old oauth token.)
Edit: Sorry for the mis-information. As it turned out I was no longer a system administrator, merely an administrator. You need to enable 2-legged impersonation option for the incomming oauth link in order for it to work properly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for answering. I have done this by creating own plugin.
In that plugin I have created a Filter with ComponentAccessor and ApplicationUser objects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got this working using the API from Python.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any success with 2-legged authentication and user impersonation? Can you share your results?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Witold, I have not been able to get it to work as yet. I have been hoping that by leaving this question here, someone would provide an answer.
If I get it working I will post the details here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thnx for answering. I spent 2 days on this with no luck. With 2-legged authentication, I expected the first token to be preauthorized - it's not. And I have no idea how to specifiy user when calling rest api.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm trying to do this as well but can't seem to find any docs about it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.