0
하지만 오류를 찾을 수 없습니다 : 을 나는 아래의 코드가 있습니다Google | 내가 구글 인증을 만들려는 OAuth를 400 redirect_uri_mismatch
$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와 일치하지 않습니다.
PS이 URI 부분이 삭제 된 것으로 보입니다. &보기 = 퀘스트 & 작업 = 가입
감사합니다.
왜 여기에 'urldecode'를 사용하고 있습니까? 그것은 절대 의미가 없습니다. – CBroe
이것은 매우 이상하지만 urldecode가 없으면이 코드가 작동합니다! 왜? – user889349
전달하는 매개 변수는 URL 인코딩이 제대로되어 있기 때문에'http_build_query'가 처리하고 고의적으로 되돌리기 만하면됩니다. – CBroe