Google OAuth2 身份验证失败(redirect_uri:缺少方案)

时间:2021-03-17 15:25:38

标签: php google-api google-oauth

我在使用用于 Google API 的 Oauth2 时遇到问题。

这是设置:

$client = new Google_Client();
$client->setApplicationName('Web client 1');
$client->addScope(Google_Service_Analytics::ANALYTICS_READONLY);
$client->setAuthConfig(APPLICATION_PATH.'/Service/oauth2.json');
$client->setIncludeGrantedScopes(true);
$client->setRedirectUri('https://my.api-1.webmetry.de/analyticsauth');
$client->setAccessType('offline');
$client->setPrompt('consent');

return $client->createAuthUrl();

在我的 Google 控制台中使用此重定向 URI 设置:

Google Console Uri

当我打开返回的 URL 时,出现此错误:

<块引用>

错误 400:invalid_request

redirect_uri 的参数值无效:缺少方案:https%3A%2F%2Fmy.api-1.webmetry.de%2Fanalyticsauth

这里有什么问题?不包括完整的绝对 Uri 等常见错误在这里似乎并非如此?

0 个答案:

没有答案