Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,464,846
Community Members
 
Community Events
176
Community Groups

How to get ApiToken for CreateRestClient

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

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 Leader Jul 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.

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

Suggest an answer

Log in or Sign up to answer