Auth0 Home Blog Docs

Delete user

management-api
delete-user

#1

Delete user gives {
“statusCode”: 404,
“error”: “Not Found”
}

please help me with this


#2

Please provide more information in your posts for us to help you.

  • Can you see the user you are trying to delete, in the dashboard?
  • Does calling the GET user endpoint return any results?
  • What call did you make to the Delete User endpoint? Please provide the request body (feel free to fudge the user_id if you want).

#3

Can you see the user you are trying to delete, in the dashboard?
Yes the user shows in the user list

Does calling the GET user endpoint return any results?
The GET method returns same result as the delete method returns.

What call did you make to the Delete User endpoint? Please provide the request body (feel free to fudge the user_id if you want).
I used the url as under:
https://url/api/v2/users/:58e4d885b5faf81852b7b290
and I passed bearer token in the request header

I tried this with postman.


#4

It looks like you are not using the correct value for the user_id parameter. The user_id should be in the form similar to auth0|577c552f12a3...., hence your Delete call should be:

DELETE
https://your-tenant.auth0.com/api/v2/users/auth0|577c552f12a3....

You can find the user_id from the user profile in the dashboard.


#5

Thankx for your response, I tried this and got the response { “statusCode”: 400, “error”: “Bad Request”, “message”: “Bad HTTP authentication header format”, “errorCode”: “Bearer” }

I used the same postman collection provided in the website


#6

You need to ensure that you are passing a valid access_token in the Authorization header. You can get an access_token for the Management API explorer from:

Auth0 Dashboard > APIs > Auth0 Management API > API Explorer.

You can then set this as the API Token in the API Explorer:
https://auth0.com/docs/api/management/v2#!/Users/delete_users_by_id

If using postman, ensure that the Authorization header is in the following format:

Authorization: Bearer <API_TOKEN>


#7

I used the api
https://myurl.auth0.com/oauth/token to get the token.

Is this API right to get the token?
I supplied necessary connection, client id etc


#8

I used the api
https://myurl.auth0.com/oauth/token to get the token.

Is this API right to get the token?
I supplied necessary connection, client id etc


#9

Please read through the following document that outlines how to obtain and use an API token for the Management API:

https://auth0.com/docs/api/management/v2/tokens


#10

The token we get from the steps written in the document is not valid it returns
{
“statusCode”: 400,
“error”: “Bad Request”,
“message”: “Bad HTTP authentication header format”,
“errorCode”: “Bearer”
}

but if we use the token from the dashboard, this returns data.
The length of token returned from the api is too short while the token from the dashboard is too long.


#11