Delete current user

Hi,

in my application, the user should be able to auto delete itself.

The code I use is:

_using (var client = new HttpClient())_
_{_

_    Configuration = builder.Build();_
_    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tok);_

_    client.BaseAddress = new Uri(Configuration["Auth0:BaseAddress"]);_
_    var result = await client.DeleteAsync("/api/v2/users/" + auth0ID);_
_    string resultContent = await result.Content.ReadAsStringAsync();_
_    var resource = JObject.Parse(resultContent);_
_}_

If I understood well, this code needs delete:users or delete:current_user.

I tried some stuff, but I’m getting a list of different errors.

  1. If I set as audience the auth0 system api, I see a lot of scope in the list, but not what I need (as wrote above)
  2. If I use custom API and create delete:users and delete:current_user, I can see them in the jwt token, but I am NOT authorized to all my others APIs I already wrote (I’m working with C# and I use the decorator [Authorize])

How can I reach my goal? I need to add those scopes to all my users and not affecting what is already working.

I’m having exactly the same issue. Did you find a solution?

Yes. I use for this aim the machine-to-machine auth

Hello everyone! I’m glad to see that you were able to overcome your issue you were experiencing @piero.alberto through utilizing the Machine to Machine application. Please let us know if you have any further questions!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.