在那里,我发现了一些错误,当我想确保与谷歌帐户登录会话。错误是:
致命错误:未捕获的invalidargumentexception:c:\xampp\htdocs\google\googleapi\src\google\client中的令牌格式无效。php:434 stack 跟踪:#0 c:\xampp\htdocs\google\callback.php(5):google\u client->setaccesstoken(array)#1{main}在c:\xampp\htdocs\google\googleapi\src\google\client.php的第434行抛出
这是我的密码:
<?php
require_once('config.php');
if (isset($_SESSION['accessToken'])){
$client->setAccessToken($_SESSION['accessToken']);
}
else if (isset($_GET['code'])) {
$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
$_SESSION['accessToken'] = $token;
}
else{
header("location: index.php");
}
$oAtuth = new Google_Service_Oauth2($client);
$user = $oAtuth->userinfo->get();
echo "<pre>";
print_r($user);
?>
请告诉我这个代码有什么问题
1条答案
按热度按时间2cmtqfgy1#
您在中的令牌值错误
$_SESSION['accessToken']
.