服务最适合用于Google以获得名称和电子邮件地址之类的基本信息

服务最适合用于Google以获得名称和电子邮件地址之类的基本信息

本文介绍了在Google的PHP客户端库中,哪种服务最适合用于Google以获得名称和电子邮件地址之类的基本信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注去年的教程,该课程教您如何在您的网站上使用使用google登录"并获取基本的用户信息.在教程中,他们使用的是Google_Oauth2Service类,该类在 PHP客户端库中找不到我下载了.

I am following this tutorial from last year, which teaches how to use Login with google for your website and get basic user info. In tutorial they are using Google_Oauth2Service class, which I could not find in PHP client library I downloaded.

有一个名为oAuth2的类似服务,但它似乎需要Google+帐户.我不想使用Google+服务.

There is a similar service named oAuth2 but it seems to require Google+ account. I do not want to use Google+ service.

推荐答案

最容易使用的是Plus API,它具有people.get函数: https://developers.google.com/+/api/latest/people/get .该功能将对所有用户有效,只要您请求profile范围-他们不必具有Google+个人资料或已授予https://www.googleapis.com/auth/plus.login范围.

The easiest thing to use is the Plus API, with the people.get function: https://developers.google.com/+/api/latest/people/get. The function will work for all users as long as you request the profile scope - they don't have to have Google+ profiles or have granted the https://www.googleapis.com/auth/plus.login scope.

这篇关于在Google的PHP客户端库中,哪种服务最适合用于Google以获得名称和电子邮件地址之类的基本信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:18