I am trying to delete a user based on id, on auth0 API v2 they give only the curl command. For the post method I managed to adapt it to angular2 http post, for some reason I cannot figure out how to use the delete request.
the id looks like this
id = auth0|582b40627882b2970253725c
This is the method I am using:
deleteAuth0User(id){
let headers = new Headers();
headers.append('Authorization', 'Bearer mytoken');
return this.http.delete('https://myusername.eu.auth0.com/api/v2/users/' + id, {headers:headers})
.map(response => response.json());
}
I have removed my auth0 username and api token.
I get this error as a result:
"{"statusCode":403,"error":"Forbidden","message":"Insufficient scope, expected any of: delete:users,delete:current_user","errorCode":"insufficient_scope"}"
Any suggestion much appreciated. Thank you
P.S. If you are interested in the post method for adding a new user:
createAuth0User(body){
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Authorization', 'Bearer myapitoken');
return this.http.post('https://myusername.eu.auth0.com/api/v2/users', JSON.stringify(body),{headers:headers})
.map(response => response.json());
}