Hi Every one,
I want to get access token using JIRA oauth1, I have gone through the documentation but unable to get how i will get consumer key.
I'm confused here.
The example you can use the consumer-key "hardcoded-consumer" along with the provided Public Key/ Shared secret key.
You mention you can instead generate public/private key.
To elaborate:
-The consumer key is made up and the service provider and the consumer both need to know it.
The private key and consumer key is used by the consumer
The public/shared key and the consumer key is used by the service provider
___________________________
So after a day of hacking at the provided java example I worked this out:
To come up with your own Consumer Key as well as using your own generated private and public keys, follow below.
------ Generate Keys ------
-Generate private key
openssl genrsa -out privkey.pem 2048
-Generate public key based off private key
openssl rsa -pubout -in privkey.pem -out pubkey.pem
------ JIRA Admin/UI: ------
-Go to Jira Administration -> Applications -> Application links
(My test, as well as the provided java example is a server-side stand alone client app i.e. doesnt respond to http/negotiate tokens so...)
-Ignore the fact that the thing attempts to connect to the link with which you create the app-link - it can be any url.
-Make up (and remember) any string value for a Consumer Key
-Copy the public key file content excluding the "-----BEGIN PUBLIC KEY-----" and "-----END PUBLIC KEY-----" as well as removing line breaks into the "Shared Secret" field.
(It might work leaving those in but I haven't bothered trying.)
-Set the Request Token URL, Access Token URL, and Authorize URL to the below, respectively, substituting your Atlassian subdomain - provided you're using a hosted instance.
https://<my-hosted-jira>.atlassian.net/plugins/servlet/oauth/request-token
https://<my-hosted-jira>.atlassian.net/plugins/servlet/oauth/access-token
https://<my-hosted-jira>.atlassian.net/plugins/servlet/oauth/authorize
-Check "Create Incoming Link" and hit Continue
-On the next screen add the same Consmer Key you decided on above and copy the content of the public key you generated above as-is.
i.e. INCLUDING the "-----BEGIN PUBLIC KEY-----" , "-----END PUBLIC KEY-----", as well as the line breaks. and hit continue
------ Client Code Changes ------
Update provided example java client found at https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication
-Update JIRAOAuthClient class CONSUMER_KEY constant (line 13) to the Consumer Key you decided on above.
-Update JIRAOAuthClient class CONSUMER_PRIVATE_KEY constant (line 14) to the private key. (I kept line breaks and BEGIN and END RSA PRIVATE KEY tags with hyphens etc.)
That code is a pretty good example of the dance.
_______________________________________________________________________
The part that was confusing me was the disconnect between the private and public key.
The client holds on to the private key (generated) and the consumer key (made up).
JIRA requires the consumer key (made up) but also the public key (generated with the private key) and JIRA needs no knowlege of the private key itself, hence it's called private.
Also if I manually go through the dance and hold on to the token and deploy it with my client app, I've read in places that the token lives forever and in others that it lives for a week.
It looks like on my hosted Confluence instance that the token is valid for 5 years.
To do the dance with confluence instead of JIRA, configure the application link in confluence administration, use the same above Request Token URL, Access Token URL, and Authorize URL for the service provider, but all UI admin/config should be done on Confluence and not JIRA. i.e: https://<my-hosted-jira>.atlassian.net/wiki. add the confluence context (in my case 'wiki') when visiting the admin/settings pages.
Hey @ekairuz
I'm following your steps -- can you help me understand the requirement for request token/ access token/ authorize URL?
For example, if my site is https://jira.test.com
will my request-token be https://jira.test.com.atlassian.net/plugins/servlet/oauth/request-token?
Appreciate your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to Clarify and clear all confusion here (https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication)
- For Consumer key and shared public key you can use Consumer key and public key as it is mentioned in link
Consumer key - "hardcoded-consumer"
Public Key/ Shared secret key -
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxZDzGUGk6rElyPm0iOua0lWg84nOlhQN1gmTFTIu5WFyQFHZF6OA4HX7xATttQZ6N21yKMakuNdRvEudyN/coUqe89r3Ae+rkEIn4tCxGpJWX205xVF3Cgsn8ICj6dLUFQPiWXouoZ7HG0sPKhCLXXOvUXmekivtyx4bxVFD9Zy4SQ7IHTx0V0pZYGc6r1gF0LqRmGVQDaQSbivigH4mlVwoAO9Tfccf+V00hYuSvntU+B1ZygMw2rAFLezJmnftTxPuehqWu9xS5NVsPsWgBL7LOi3oY8lhzOYjbMKDWM6zUtpOmWJA52cVJW6zwxCxE28/592IARxlJcq14tjwYwIDAQAB
Or you could generate your public/private key using below method and update the client code accordingly
To generate a key pair execute:
openssl genrsa -out privkey.pem 2048
And execute:
openssl rsa -pubout -in privkey.pem -out pubkey.pem
To extract the public key. Both keys are in PEM format
create an Application Link
Enter valid URL and click Continue even if there is no response on URL
Taha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
quesiton - what do you mean extract public key? and PEM format? and updating the client code? what do you update? I'm so sorry for all the quesitons. do you run this code in terminal? and do the pubic consumer keys and public shared secret work for private tools? are those two for the user to be entered everytime they login as their login or is it just for communication between the two websites to get the login where the user logs in with JIRA?
sorry and thanks
nicole
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Taha,
I have gone through the given url. I have below mentioned concerns.
Please provide me information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your Url seems to be https, so you to import your ssl certificate first into Java keystore before configuring application link. Taha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry sir but in screen I can see entered URL as https://mybeeps.com.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Taha,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, above URL Is for OLD JIRA version. OAuth Configuration comes under Application links itself. Original Document which I shared is the right one and all steps are mentioned there https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Consumer key and public key both are part of OAuth process. Since your requirement is to configure App link between JIRA and External Application you refer below link for more information on Configuring OAuth Consumer
https://confluence.atlassian.com/display/JIRA042/Configuring+OAuth+Consumer+Information+for+JIRA
Taha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Namdev,
You can get Consumer key when you configure Application Link between Source and Destination Instance.
Taha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.