我正在使用google / apiclient开发Yii2。我不断收到“错误:redirect_uri_mismatch”
似乎无用,有见识吗?
我的代码没什么特别的:
$session = Yii::$app->session;
$gClient = new Google_Client();
$pathToSecret = Yii::getAlias('@app/auth/gCalendar_ClientSecret.json');
$gClient->setAuthConfig($pathToSecret);
$gClient->addScope(Google_Service_Calendar::CALENDAR_EVENTS_READONLY);
$gClient->setLoginHint('[email protected]');
if ($session->has('oauth_access_token')) {
$gClient->setAccessToken($session->get('oauth_calendar_access_token'));
//do something else
} else {
$redirectUri = Url::toRoute('/calendar/oauth-response', 'http');
$gClient->setRedirectUri($redirectUri);
return $gClient->createAuthUrl();
}
基于错误,请求似乎正常:
请求中的重定向URI,http://localhost/ascoSL/public_html/sl/index.php?r=calendar%2Foauth-响应,与为OAuth客户端授权的响应不匹配。更新授权的重定向URI,请访问:https://console.developers.google.com/apis/credentials/oauthclient/XXXXX
<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS94bmFxQS5wbmcifQ==” alt =“请参阅我的Google配置的捕获”>
我正在使用google / apiclient开发Yii2。我不断收到“错误:redirect_uri_mismatch”,我已将“ http:// localhost”设置为授权重定向尝试过“ https:// localhost”尝试过“ https:// ...