Forums

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

How to get ApiToken for CreateRestClient

Doug Duthie
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!
July 26, 2022

I'm trying to create a client to query Jira using the REST API.

I gather for CreaterestClient, basic authentication will now longer work and I need to use an apiToken.

How do I get this? I can't see anything under my user profile in Jira. Or should I be using OAuth...there is something under the profile to view OAuth tokens

I'm attempting to connect to Jira V8.13.21 (I assume this is Server)

2 answers

0 votes
david catriel
Contributor
October 19, 2022

I'm in the same bag. The C# API has a CreateOAuthRestClient() method, but the params don't seem to correspond at all to what Jira provides on the oAuth setup page, so it's all quite confusing.

 

Jira provides a client ID and secret key, but the API expects you to pass a consumer key, consumer token (both of which are probably what jira supplies), and also an oAuth access token and oAuth token secret. There's no apparent documentation within jira on where to get those last two items.

0 votes
Craig Nodwell
Community Champion
July 26, 2022

Hi @Doug Duthie welcome to the community.  Jira Server uses either Basic authentication or OAuth 2.0.  Follow the steps for OAuth2.0 and you'll be fine.
Here's a page for your reference.

Doug Duthie
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!
July 28, 2022

Thanks for your response.

I'm still a little confused about how to move forward. I'm developing a .NET app and trying to use the CreateRestApi method.

I can't see how CreateRestApi can use OAuth2.0 - there are only examples for basic authentication and ApiToken.

I'm assuming Basic Auth won't work - I get 500 returned if I attempt this.

So, can the .NET library work with OAuth2.0 or should I bin that and just go with a more native approach and use the OAuth client example?

Also, on the Jira side, what rights are needed to set up the application link for OAuth (just so I know who to go to in my organisation)?

 

Thanks

Grant Davis
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!
July 12, 2023

Hello its July 2023 and am trying to follow the instructions myself and have no idea how to proceed as well, the page link given above does not help!

I would also know how to setup the all the tokens for CreateOAuthRestClient so that it works in c#. My company has an existing app but it seems the tokens have stopped allowing all data to come thru, such as the attached images.

 

Please help so I get make the app work properly again.

Suggest an answer

Log in or Sign up to answer