User failed to authenticate when deactivating users

Victor Muniz May 31, 2019

Hello.

I have a python script that I use to deactivate users periodically.

Suddenly it stops to work, I still can get a list of all the registered users but when I try to deactivate any of them I got the following message:

Error Deactivating USERNAME: JiraError HTTP 401 url: https://my_url/admin/rest/um/1/user/deactivate?username=USERNAME
text: User failed to authenticate

I am a administrator, I was using email/password but even when changed to email/token I got the same error.

The script is simple like that:

jira = JIRA(basic_auth=(atlassianEmail, atlassianToken),
#options={'server': 'https://my_url'})

jira.deactivate_user(USERNAME)

Do anyone have any ideas? 

4 answers

0 votes
nitish vulli May 14, 2020

I am able to disable user using below rest API.

 

https://developer.atlassian.com/cloud/admin/user-management/rest/#api-users-account-id-manage-lifecycle-disable-post

 

you need to generate API @https://admin.atlassian.com/ -> settings

In order to manage user users, you have to verify your domain.

let's say your users contain email =  user@test.com,  you need to verify the test.com domain.

 

domain verification steps:
https://admin.atlassian.com/ -> directory->domains

you can disable /delete user from https://admin.atlassian.com/ ->directory->usermanagement

 

sample request

curl --request POST \ --url 'https://api.atlassian.com/users/<user_id>/manage/lifecycle/disable' \ --header 'Authorization: Bearer XXXXX' \ --header 'Content-Type: application/json' \ --data '{ "message""On 6-month suspension"}'

 

this should be user id:<user_id>

Authorization: Bearer XXXXX .

XXXXX = APi key 

0 votes
nitish vulli December 4, 2019

I am able to disable user using below rest API.

 

https://developer.atlassian.com/cloud/admin/user-management/rest/#api-users-account-id-manage-lifecycle-disable-post

 

you need to generate API @https://admin.atlassian.com/ -> settings

In order to manage user users, you have to verify your domain.

let's say your users contain email =  user@test.com,  you need to verify the test.com domain.

 

domain verification steps:
https://admin.atlassian.com/ -> directory->domains

you can disable /delete user from https://admin.atlassian.com/ ->directory->usermanagement

nitish vulli December 4, 2019

sample request

curl --request POST \ --url 'https://api.atlassian.com/users/<user_id>/manage/lifecycle/disable' \ --header 'Authorization: Bearer XXXXX' \ --header 'Content-Type: application/json' \ --data '{ "message": "On 6-month suspension"}'

 

this should be user id:<user_id>

Authorization: Bearer XXXXX .

XXXXX = APi key 

0 votes
Simon Hansson December 4, 2019

I'm having the same issue.

0 votes
nitish vulli August 11, 2019

me too getting same issue can someone help??

Suggest an answer

Log in or Sign up to answer