oauth 2.0 - Google oauth2 returns no id_token -
i seem miss oauth2. access_token not id_token!
i use following gain google access_token passing "code" granted me 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); everything seems work according google's documentation https://developers.google.com/accounts/docs/oauth2login#exchangecode should getting access_token, id_token, expires_in, token_type except id_token
var_dump($json_response); shows following:
string(126) "{ "access_token" : "ya29.ahes6zsglhvw9qa23xs8bhbp578ef8s5cntjicpt_shwa", "token_type" : "bearer", "expires_in" : 3598 } what missing here?
at token endpoint id_token issued if scopes present, documentation should clarify that.
it issued if email, profile or openid connect scopes used. id_token not make sense otherwise.
Comments
Post a Comment