I’m a Japanese.
So, maybe my English is so bad.
Sorry.
I want to use API of Auth0 about update user’s metadata.
=> https://auth0.com/docs/metadata/apis#update-user-metadata
However, this PHP’s sample written in cURL.
So I rewrite the sample to Guzzle.
However, the code I rewrite will return 401 error.
I am in trouble understanding this cause.
In fact, for POST and GET codes, 200 values will be returned.
I do not know if this cause is in Auth0 or in my code.
If you do not mind, would you mind checking out my code?
$data = [
'form_params' => [
'user_metadata' => ['addresses' => ['home' => '123 Main Street, Anytown, ST 12345']]
],
'header' => [
'content-type' => 'application/json',
'Authorization' => 'Bearer ABCD'
],
];
$guzzleClient = new Client();
$res = guzzleClient->request('PATCH', 'https://YOUR_AUTH0_DOMAIN/api/v2/users/id_of_user', $data);
var_dump(res->getBody()->getContents());
# 401 returned
# {"statusCode":401,"error":"Unauthorized","message":"Missing authentication"}
Thank you.