Hello,
I am a Jira administrator. We are trying to set up an automated process using the Jira REST API with a dedicated service account, but we are unable to authenticate successfully.
Issue Details:
When attempting to verify the service account's credentials by making a request to the /rest/api/3/myself endpoint, the API consistently returns a 401 Unauthorized error with the message: Client must be authenticated to access this resource.
This occurs even when using a newly generated API token and the standard Basic Authentication method.
Steps to Reproduce:
A new API token was generated for the service account.
The string email:api_token was Base64 encoded.
A curl request was made as follows:
1 curl -v -H "Authorization: Basic <base64_encoded_string>" https://<domain>.atlassian.net/rest/api/3/myself
The response is a 401 Unauthorized with the body: Client must be authenticated to access this resource.
Additional Context:
Our ultimate goal is to access the /rest/api/3/issue/createmeta endpoint. When we try to access it, we receive a different error: {"errorMessages":["You cannot create issues in this project.","You are not authorized to perform this operation. Please
log in."],"errors":{}}. We believe this second error is due to project permissions, but we are currently blocked from troubleshooting it because of the fundamental authentication failure.
Troubleshooting Steps Already Taken:
Verified the service account exists and is active in our Atlassian organization.
Generated a new API token and ensured it was copied correctly.
Confirmed the correct Base64 encoding of the email:api_token string.
As the Jira administrator, I have reviewed the project permissions for the project and am aware of the need to grant "Browse Projects" and "Create Issues" permissions to the service account's role.
Our Request:
Could you please investigate from your side why REST API authentication is failing for this service account? We need to understand if there is an account-level restriction, a configuration issue on our instance, or another reason that would prevent a
valid API token from being accepted for this specific user.
Community moderators have prevented the ability to post new answers.
Hi,
Did you add the correct scope for the api token ?
Manage API tokens for service accounts | Atlassian Support
To add to @Mohamed Benziane answer, when using a service account you also have to use a different URL, you have to the Platform API Gateway URLs beginning with api.atlassian.com. Please see this KB for more information.
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.