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,461,714
Community Members
 
Community Events
176
Community Groups

Connect with REST API through Oauth2.0

Hello everybody. I tried to connect to my jira cloud instance with basic authentication but it throws me "deprecation" error. I've generated the code api with Swagger.

Is it possible to use the same code api but with Oauth authentication?

2 answers

1 accepted

1 vote
Answer accepted
Ismael Jimoh Community Leader May 06, 2021

Hi @Matteo De Franceschi 

To connect your cloud instance using basic auth, you need to:

  1. Generate a token as explained here
  2. Next parse your username and the token as password to authenticate to your instance.

For Oauth, I believe this is also possible, however, I need to look this up.

Regards

Ismael Jimoh Community Leader May 06, 2021

You can have a look at the following for Oauth authentication with Cloud.

Regards.

Ah ok, just tried and the authentication is working now.

Just another thing. When i try to achieve a Project it throws me this error:

Exception in thread "main" java.lang.IllegalArgumentException: missing discriminator field: <>
at com.atlassian.oauth.client.example.config.JSON.getDiscriminatorValue(JSON.java:2247)
at com.atlassian.oauth.client.example.config.JSON.access$000(JSON.java:37)
at com.atlassian.oauth.client.example.config.JSON$18.getClassForElement(JSON.java:1988)

 

Do you now something about?

Any updates on this, would be great if anyone could help in how to tackle this?

I got this to work, that is I have a test project which I can read the content of the issue with the correct oauth2 token and this path : 

first you go here : https://developer.atlassian.com/console/myapps/

create a app. Add all the scopes you need for access and take note of the client secret parts it generates

then you can go here : https://auth.atlassian.com/oauth/token
with grant type client_credentials

client_id and client_secret from that previous page

scope = your list of scopes you want

and if thats correctly done you get a access_token

 

then you call this : https://api.atlassian.com/oauth/token/accessible-resources 

 

and from there you get id: url etc. use that id as couldid here in the last thing below

https://api.atlassian.com/ex/jira/<cloudid>/rest/api/3/issue/<projectname>-<issue number>

 

and from that you can get issue details from jira.

 

hope that helps.

 

Regards,

Emil

Hi,  when call this : https://api.atlassian.com/oauth/token/accessible-resources 

return all jira site, but i want to get only the datanet of the one i selected from sending code․ what can I do?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD Trial
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events