Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Authentication Error While Deactivating Jira User via REST API

monica190
Tera Guru

Hi Team,

I’m currently working on integrating ServiceNow with Jira. I have a requirement to deactivate a user in Jira once they leave the organization. As per Atlassian’s documentation : The Jira Cloud platform REST API I’m following the mentioned steps. However, I’m receiving the following error response:

{ "errorMessages": [ "You are not authenticated. Authentication required to perform this operation." ], "errors": {} }

 

This occurs even though, in Postman, I receive a message saying “Authentication successful” when I click on Get New Access Token.

 

1 ACCEPTED SOLUTION

monica190
Tera Guru

It turns out that the Basic Auth API key must be generated by an Org Admin, not a regular admin user — otherwise, you’ll encounter an error. The Atlassian team is aware of this bug, but there hasn’t been much progress on fixing it yet.

So, I always recommend generating the token using an Org Admin account. Also, even if the Org Admin user leaves the company later, it does not impact the API key — so you’re safe there and don’t need to worry.

View solution in original post

4 REPLIES 4

palanikumar
Giga Sage
Giga Sage

Have you tried this operation in Postman and does it work?

If it works in Postman, then you need to check the OAuth configuration in ServiceNow. As per the error message, the authentication information is not included in the REST API call

Thank you,
Palani

Hi Palani,

Thanks for your response.

I’ve tried the operation in Postman itself as mentioned in my post, and it's not working.

Me Being Mustaq
Tera Guru

Hi @monica190 ,

 

The “You are not authenticated” error usually means your access token isn’t being sent correctly in the API request — even if Postman says authentication was successful. You need to ensure the token is included in the actual request header and that you're using the correct API scope and endpoint.

 

You can double check this

 

1. Token Format in Authorization Header:-Jira Cloud APIs require Bearer Token authentication. Your request header must look like Authorization: Bearer <access_token>

 

In Postman:

  • Go to Authorization tab.

  • Select Bearer Token.

  • Paste the token in the field.

  • Ensure “Add authorization data to” is set to “Request Headers”.

 

 

2. Correct API Endpoint:-To deactivate a user, use  POST

You’re using the account ID not username or email. The token has access to user management APIs.

 

3. Required Scopes

Your OAuth token must include the following scopes:

  • read:me

  • manage:users

  • read:users

If you’re using Atlassian’s OAuth 2.0 (3LO), these scopes must be explicitly granted during token generation.

 

 

4. Cloud vs Site-Specific API

If you’re using the site-specific REST API (https://.atlassian.net/rest/api/...), it may not support user lifecycle operations. Use the Atlassian Cloud API instead.

 

Try this from a terminal to verify:

curl -X POST \
url/users<account_id>/manage/lifecycle/disable \
-H "Authorization: Bearer <your_token>" \
-H "Accept: application/json"

If this works, the issue is likely with how Postman or ServiceNow is sending the token.

 

 

When calling Jira from ServiceNow:

  • Use REST Message with OAuth 2.0 profile.

  • Ensure the profile is linked to the correct token and scopes.

  • Use setRequestHeader("Authorization", "Bearer " + access_token) if manually scripting.

If it is helpful, please hit the thumbs button and accept the correct solution by referring to this solution in the future it will be helpful to them.

 

Thanks & Regards,

Mohammed Mustaq Shaik

monica190
Tera Guru

It turns out that the Basic Auth API key must be generated by an Org Admin, not a regular admin user — otherwise, you’ll encounter an error. The Atlassian team is aware of this bug, but there hasn’t been much progress on fixing it yet.

So, I always recommend generating the token using an Org Admin account. Also, even if the Org Admin user leaves the company later, it does not impact the API key — so you’re safe there and don’t need to worry.