I am writing C# code to interact with the Jira API and even though I can get Authenticated using OAuth I still get a 401 whenever I try to call the API.
I am creating my HttpClient class using the "bearer <token>" string and I am calling the right endpoints, so I am not sure what the problem could be.
Hi @BernardoCoSo Can you share the Endpoint you are trying to reach? Have you checked if the user account that you are using has the required permissions to perform the operation?
Permissions to check:
1. Jira application access
2. Project permission scheme - user part of right roles
3. Are you trying to do an system admin operation? Then the user should have admin access.
Hope this helps.
Hey Anandhi,
Thank you for the suggestions!
I am trying to use the "rest/api/3/myself" and a few others. I have given myself all the Jira Platform and Management permissions and I am using the scopes it recommends in the "Classic Jira platform REST API authorization URL".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@BernardoCoSo Were you able to try this endpoint on a browser or postman? Check if your credentials are right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the problem has something to do with exchanging my authorization code for the token. I am getting something that doesn't look like an access token!
I tried getting the "token" to work in postman but I get the same error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you generate an API token from id.atlassian.com?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried by doing it that way and by using OAuth but none of the ways work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this the same on Postman? Can you try with anyother API endpoints?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's the same in Postman and my C# tool, and when I try with the user endpoint I get:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you access Jira through UI? Are you using Jira Cloud or Jira DC?
1. Use Basic Auth - Username and API Token
2. Try GET on /rest/api/2/project/{projectIdOrKey} endpoint
If this still throws 401, Do you have application access on Jira? Can you access your content through the UI?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have access to this project? can you view this issue through a browser?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was using the wrong key, to do the basic authentication! I changed it on Postman and it worked, I also did it in my code successfully!
Thank you so much for the help and patience!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.