如何将Google OpenID迁移到OAuth? openid_id似乎不见了

时间:2014-08-31 21:32:05

标签: php oauth-2.0 openid

由于谷歌已弃用OpenID支持,我认为我会尝试迁移,但男孩是一项承诺。我已经到了可以从谷歌获取用户数据的地步,但我无法弄清楚如何获得用户的OpenID标识符。文档说我可以在请求访问代码时添加openid.realm作为参数,它应该返回一个openid_id字段。但事实并非如此。我的请求看起来像这样:

$params = array(
    "response_type" => "code",
    "client_id" => $appdata['client_id'],
    "redirect_uri" => self::$REDIR,
    "scope" => "https://www.googleapis.com/auth/userinfo.email",
    "state"=>$callback,
    "openid.realm"=>$openid->trustRoot
);
$request_to = 'https://accounts.google.com/o/oauth2/auth'. '?' .http_build_query($params);
header("Location: " . $request_to);

返回字段:

["access_token","token_type","expires_in","id_token"]

我做错了什么或这是谷歌的错误?

0 个答案:

没有答案