Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/authentication/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Authentication 我如何使用OAuth 2.0进行Google的身份验证?_Authentication_Oauth 2.0 - Fatal编程技术网

Authentication 我如何使用OAuth 2.0进行Google的身份验证?

Authentication 我如何使用OAuth 2.0进行Google的身份验证?,authentication,oauth-2.0,Authentication,Oauth 2.0,代码太棒了。它给出了如何将OAuth 2与Google API结合使用的好例子。问题是我只想将OAuth 2用于身份验证,而不是用于授权。我在API中查找了一些仅进行身份验证的内容,但找不到正确的类 如何将Google PHP客户端配置为仅通过OAuth进行身份验证? 我考虑过只验证客户端(即,`$client->authenticate($\u GET['token']),但这并不理想,因为仍然要求用户授权访问不同的资源。我不想看到他们的电子邮件、图片等。我只想让谷歌确认他们是他们所说的人。好

代码太棒了。它给出了如何将OAuth 2与Google API结合使用的好例子。问题是我只想将OAuth 2用于身份验证,而不是用于授权。我在API中查找了一些仅进行身份验证的内容,但找不到正确的类

如何将Google PHP客户端配置为仅通过OAuth进行身份验证?

我考虑过只验证客户端(即,`$client->authenticate($\u GET['token']),但这并不理想,因为仍然要求用户授权访问不同的资源。我不想看到他们的电子邮件、图片等。我只想让谷歌确认他们是他们所说的人。

好吧,不是为了认证

但是,大多数提供商都会让您有机会查询用户配置文件,因此您可以对用户进行身份验证。如果不访问他的个人资料数据,尤其是他的用户id,您就无法实现这一点


请参阅谷歌的文档以了解。

如果您只想使用身份验证,则必须使用:OpenID/联合登录。
请参阅:

Google API文档中有一节说“OAuth:Login”,这让我相信有一种方法可以仅将OAuth用于身份验证。