oauth2로 뭔가를 놓치고있는 것 같습니다. access_token
이 표시되지만 id_token
은 표시되지 않습니다.Google oauth2는 id_token을 반환하지 않습니다.
나는이 일을 https://accounts.google.com/o/oauth2/auth
$oauth2token_url = "https://accounts.google.com/o/oauth2/token";
$clienttoken_post = array(
"code" => $code,
"client_id" => $client_id,
"client_secret" => $client_secret,
"redirect_uri" => $redirect_uri,
"grant_type" => "authorization_code"
);
$curl = curl_init($oauth2token_url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $clienttoken_post);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$json_response = curl_exec($curl);
curl_close($curl);
var_dump($json_response);
모두에서 저에게 부여는 "코드"를 전달하여 access_token은 구글을 얻을 것 같다 다음하지만 구글의 설명서에 따라 사용 https://developers.google.com/accounts/docs/OAuth2Login#exchangecode 나는 제외 할 access_token, id_token, expires_in, token_type
을 받고해야
string(126) "{ "access_token" : "ya29.AHES6ZSGlHVW9qA23xs8bHBP578Ef8S5cntJIcPT_SHWA", "token_type" : "Bearer", "expires_in" : 3598 }
다음
id_token
var_dump($json_response);
에 대해 다음을 보여줍니다
여기에 무엇이 누락 되었습니까?
덕분에 많은 사람. 나는 여기서 id_token을 얻는 방법을 알아 내려고 며칠 동안 머리카락을 당겨 왔습니다. 전자 메일 범위를 포함하고 트릭을 수행하기를 바랍니다. – Kal
@Kal이 대답을 수락하고 나서 대답을 올리면 크게 감사 할 것입니다. – mariuss