PHP谷歌“身份验证”例外情况:;“收件人错误”;使用Google API PHP客户端时
在Google API PHP客户端中尝试使用PHP谷歌“身份验证”例外情况:;“收件人错误”;使用Google API PHP客户端时,php,google-api,google-api-php-client,Php,Google Api,Google Api Php Client,在Google API PHP客户端中尝试使用verifyIdToken()时,出现以下错误 PHP Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Wrong recipient, **API KEY OMMITED FOR LENGTH**.apps.googleusercontent.com != :' in C:\includes\gplus\src\Google\Auth\OAuth2.php
verifyIdToken()
时,出现以下错误
PHP Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Wrong recipient, **API KEY OMMITED FOR LENGTH**.apps.googleusercontent.com != :' in C:\includes\gplus\src\Google\Auth\OAuth2.php:621
Stack trace:
#0 C:\includes\gplus\src\Google\Auth\OAuth2.php(497): Google_Auth_OAuth2->verifySignedJwtWithCerts('**TOKEN OMMITED**', Array, '', Array)
#1 C:\includes\gplus\src\Google\Client.php(482): Google_Auth_OAuth2->verifyIdToken('**TOKEN OMMITED**')
#2 C:\tjWEB\googlesignin\token.php(8): Google_Client->verifyIdToken('**TOKEN OMMITED**')
#3 {main}
thrown in C:\includes\gplus\src\Google\Auth\OAuth2.php on line 621
我的PHP代码如下:
<?php
require_once 'C:/includes/gplus/src/Google/autoload.php';
$client = new Google_Client();
$client->setApplicationName("My Application");
$client->setDeveloperKey("**TOKEN OMMITED**");
var_dump($client->verifyIdToken($_POST["idtoken"]));
?>
调用它的页面是可用的。我假设所有可能阅读本文的人都知道如何在他们选择的浏览器中查看源代码
我在谷歌上找不到任何解决方案,因此任何帮助都将不胜感激。
谢谢 好的,我找到了导致这个问题的原因 我需要补充一点
$client->setAuthConfigFile('C:/includes/client_secret.JSON');
给它我的秘密API密钥的PHP代码。如果您还没有密钥,可以下载它
TL;我博士因为没有阅读文档而搞砸了