Hello, I want to bring all issues in Jira or certain issues with JQL through my application. I can get a single issue by sending a request as /rest/api/3/issue/T1-1. However, when I request /rest/api/3/search?jql=..., I get the error {“code”:401,“message”:“Unauthorized; scope does not match”}.
Here is my code below:
Hi @Mertcan Karabaş ,
You have to use base64 encoded api token.
Hi @Vijay Dadi
Where do in the code should I add the base64 api token? and how can i get this token? If I need to create and use 'https://id.atlassian.com/manage-profile/security/api-tokens' from here, how can I request this from users?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The api token has to be generated for your service account one time and can be re-used. Once you encode it for base 64, use it in your header as
'Authorization': 'Basic <base64 encoded api token>'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using macOS and I created the base64 token in the terminal like this:
echo -n my_mail@gmail.com:my_api_token | base64
then i added to my header but i got same error. Could there be another problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Vijay Dadi
I solved the problem and the reason was from a different part of the code. I was checking whether the input I received was undefined or null and that's why it was entering the second if block. Therefore, since the request was sent as rest/api/3/issue/, it gave an error. Again, thank you very much for your help.
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.