I already created an API key so I know that is not the problem. I get a 401 error code when I run my script. My guess is that I need a premium Jira account in order to use the function below because I think it might fall under global and multi-project automation.
Disable a user
POST /users/{account_id}/manage/lifecycle/disable
Disables the specified user account. The permission to make use of this resource is exposed by the lifecycle.enablement
privilege. You can optionally set a message associated with the block that will be shown to the user on attempted authentication. If none is supplied, a default message will be used.
Hi @StevenKayvanfar,
Are you able to call any user management APIs or do they all return 401 responses?
Regards,
Dugald
1 Like
Same for me, but i get 403 status code .
i am able to use the https://api.atlassian.com/users/[ID]/manage and the https://api.atlassian.com/users/[ID]/manage/profile call with the admin api token. but when i try the POST /users/{account_id}/manage/lifecycle/disable we get this error:
{"key":"forbidden.action","context":{"allowed":false,"reason":{"key":"externalDirectory.scim"}},"errorKey":"forbidden.action","errorDetail":{"allowed":false,"reason":{"key":"externalDirectory.scim"}}}
which seems to be related to the lifecycle.enablement
privilege
any luck with resolving it?
@StevenKayvanfar
@dmorrow
Hi @AmramEnglander,
I’m not familiar with the User Management REST API, but judging by the error, it seems your call to /users/{account_id}/manage/lifecycle/disable
a user was not authorized due to your configuration being based on an external directory and that the way to disable the user would involve some action directly on this external directory.
I’ll try to get an expert can confirm this.
Regards,
Dugald
1 Like
hi @dmorrow
we have the same error, while we are trying to replace email adresses. we have migrated from an other AD.
{"key":"forbidden.action","context":{"allowed":false,"reason":{"key":"externalDirectory.scim"}},"errorKey":"forbidden.action","errorDetail":{"allowed":false,"reason":{"key":"externalDirectory.scim"}}}
any idea how to solve it?
I am also receiving this error when trying to disable a user via the API.
I am trying to do this via powershell.
How to trigger the switch “Has access on site” under users details via API?
We want to disable certain users access but still want to keep the user in the system for next 90days before we delete the user.
I tried:
$url = “JIRA_url/user?accountId=yyy”
$body = @{
active = “False”
}
Invoke-RestMethod -Method PUT -Uri $url -Body $body
I got the error:
Invoke-RestMethod : The remote server returned an error: (405) Method Not Allowed
Same issue here, I also get the 403 error. Did anyone already find out what is causing this and how to resolve this issue?
Thank you in advance.
Hi!
I’m new to Atlassian, and I got the same issue as this, was anyone able to get a resolution on the problem?
I have this issue as well. I’m not sure what we can do to disable a user.
I am having this exact same issue of 403 error and externalDirectory.scim as key.