我想创建Google身份验证但无法找到错误: 我的代码如下:
$client_id = 'xxxxxxx-4bsrudsadhna5817fddlhmf02ihgrcr0.apps.googleusercontent.com';
$client_secret = 'xxxxxxxxxxxxxxxxxx';
$redirect_uri = 'http://`localhost`/joomla/index.php?option=com_component&view=quest&task=signup';
$url = 'https://accounts.google.com/o/oauth2/auth';
$params = array(
'redirect_uri' => $redirect_uri,
'response_type' => 'code',
'client_id' => $client_id,
'scope' => 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'
);
$this->google_auth_link = $url . '?' . urldecode(http_build_query($params));
echo '<a href="'.$this->google_auth_link.'">Login using Google +</a>';
但这会让我回头:
400 - That’s an error.
Error: redirect_uri_mismatch
请求中的重定向URI:http:// localhost
/joomla/index.php?option=com_component与注册的重定向URI不匹配
P.S似乎已经删除了URI的这一部分:&amp; view = quest&amp; task = signup
谢谢!
答案 0 :(得分:0)
您无法在单引号内使用反引号运算符。第3行应该是
$redirect_uri = 'http://'.`localhost`.'/joomla/index.php?option=com_component&view=quest&task=signup';