Auth0: User to be acted on does not match subject in bearer token

Viewed 768

{"statusCode":403,"error":"Forbidden","message":"User to be acted on does not match subject in bearer token.","errorCode":"unowned_resource"}

   curl_setopt_array($curl, array(
 CURLOPT_URL => "https://XXXXXXXXX.auth0.com/api/v2/users    /auth0|XXXXXXXXX",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode($postpassword),
    CURLOPT_HTTPHEADER => array(
    "authorization: Bearer ".$accesstoken,
    "content-type: application/json"
  ),
));

Hope this is something related to settings in auth0 configuration.

Can any one help on about this error..

1 Answers

I had the same problem and I figured out a solution for me.

I missed some scopes for my application. Under APIs, Auth0 Management API, Machine to Machine Applications expand your application (click the downward arrow besides the Authorized switch) and add read:users and maybe read:users_app_metadata.

Related