WARNUNG: UNDEFINED Array Key "client_id" in C: \ xampp \ htdocs* * ********* \ VENDOR \ google \ apiclient \ src \ google \ \ client.php on line 868 p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> p> pl. />
Warning: Undefined array key "client_secret" in C:\xampp\htdocs*********\vendor\google\apiclient\src\Google\Client.php on line 869. C: \ xampp \ htdocs ******** \ Vendor \ Google \ auth \ src \ oAuth2.Php in Zeile 633 < /p>
< /blockquote>
In der nach oben genannten Datei.
Code: Select all
if (is_null($params['client_id'])) {
throw new InvalidArgumentException(
'missing the required client identifier');
}
< /code>
´´´ < /p>
$cliente = new Google_Client();
$cliente->setAuthConfig('modelos/client_secret.json');
/*The error seems to be here, for some reason the returned values are being read as empty or null values, How should I proceed to get proper access to those values inside the JSON file?*/
$cliente->setAccessType("offline");
$cliente->setScopes(['profile','email']);
$rutaGoogle = $cliente->createAuthUrl();
if(isset($_GET['code'])){
$token = $cliente->fetchAccessTokenWithAuthCode($_GET['code']);
var_dump($token);
$_SESSION['id_token_google'] = $token;
$cliente->setAuthConfig($token);
}
if($cliente->getAccessToken()){
$item = $cliente->verifyIdToken();
var_dump($item["email"]);
$datos = array("nombre"=>$item["name"],
"email"=>$item["email"],
"foto"=>$item["picture"],
"password"=>"null",
"modo"=>"google",
"verificacion"=>0,
"emailEncriptado"=>"null");
$respuesta = ControladorUsuarios::ctrRegistroRedesSociales($datos);
echo '
setTimeout(function(){
window.location = localStorage.getItem("rutaActual");
}, 1000);
';
}´´´