Hi, I try to add an address through the Google cloud API with the following code :
- send_method = PATCH
$headers=array('Authorization: Bearer ' . $access_token, 'Content-Type: application/json');
$send_method = "PATCH";
$access_token = "ya29.GltEBKYRM25dDrsBizJ4oCreSB7o5BxOTH47Xm7Z8wugqPnNkDWbfJStxXDW-aE3ey37f6p7zU38hkSrv9nqPQ8IyOhYQF1TKliaOlDYePh3582XhzXc6cWNVq5G";
$payload = '{"settings" : {"ipConfiguration" : {"authorizedNetworks" : [{ "value": "35.185.139.68" }]}}}';
$settings = array(
CURLOPT_CUSTOMREQUEST => $send_method,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => 0,
[CURLOPT_POSTFIELDS] => $payload
);
$curl = curl_init($url);
curl_setopt_array($curl, ($settings));
$result = curl_exec($curl);
curl_close($curl);
I know that my token is ok because it has been provided by the Oauth playground.
I use a service account and I declared myself as owner.
But, unfortunately, I got the following error (even on Oauth playground):
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
What can I do?