Php Google_Auth_异常:刷新OAuth2令牌时出错

Php Google_Auth_异常:刷新OAuth2令牌时出错,php,google-plus-signin,Php,Google Plus Signin,我正在尝试使用PHP从google plus获取用户数据。 我正在使用下面的教程 情况: 用户使用google plus按钮登录我的android应用程序我使用googleSignInResult.googleSignInAccount.getIdToken()获取访问令牌 我将此令牌发送到我的服务器,该服务器运行php,使用google php客户端获取用户数据(如视频中所述) 下面是我的代码 try{ $gClient = new Google_Client();

我正在尝试使用PHP从google plus获取用户数据。 我正在使用下面的教程

情况: 用户使用google plus按钮登录我的android应用程序我使用
googleSignInResult.googleSignInAccount.getIdToken()获取访问令牌

我将此令牌发送到我的服务器,该服务器运行php,使用google php客户端获取用户数据(如视频中所述) 下面是我的代码

try{
            $gClient = new Google_Client();
            $gClient->setApplicationName('pixyfi');
            $gClient->setClientId($config['google']['appid']);
            $gClient->setClientSecret($config['google']['secret']);
            $token = json_encode(array("access_token"=>$lptoken,"refresh_token"=>$lptoken,"token_type"=>"Bearer","expires_in"=>3600,"id_token"=>$lptoken,"created"=>1320790426));

            $gClient->setAccessToken($token);
            $gClient->addScope(Google_Service_Plus::PLUS_ME);
            $plus = new Google_Service_Plus($gClient);

            $gpUserProfile = $plus->people->get('me');
            echo "User Fetched as:".$gpUserProfile['id'];
        }
        catch(Google_Auth_Exception $x){
            echo "Error:".$x;
        }
但我得到了一个错误: 错误:Google_Auth_异常:刷新OAuth2令牌时出错,消息:'{ “错误”:“无效的\u客户端” }'in/var/www/html/api/auth/vendor/google/apiclient/src/google/auth/OAuth2.php:364


您能告诉我我在这里犯了什么错误吗?

这是我处理令牌的一些代码。实现这一逻辑,如果仍然出现错误,请告诉我

$row是从数据库中提取的,包含令牌信息

$client->setAccessToken($row['token']);
        if(time()>$row['created']+$row['expires_in'])
        {       
                $client->refreshToken($row['refresh_token']);
                $token=$client->getAccessToken();
                DB::Query("-----UPDATE DB TOKEN INFO-------");
                $client->setAccessToken($token);

        }

您将令牌存储在哪种字段中?(是否足够容纳整个访问和刷新令牌)我不确定刷新令牌和访问令牌之间的区别。从,,开始,看起来两者是一样的。是的,完整的令牌正在从android传输到php服务器