oauth - 要求 Google 返回电子邮件地址作为 OAuth 的一部分

标签 oauth dotnetopenauth

我正在使用 OAuth 通过 dotNetOAuth 访问 Gmail。如何强制 Google 在授权后回调中返回用户的电子邮件地址?

默认情况下,Google OAuth 回调仅返回 token key 和访问 token 。

最佳答案

首先,您需要将以下范围 ( https://www.googleapis.com/auth/userinfo.email ) 添加到您的 oauth 请求中。

从 Google 返回到您的应用并获得访问 token 后,您可以使用访问 token 向 https://www.googleapis.com/userinfo/email?alt=json 发出请求。 这将返回电子邮件地址。更多信息请访问http://sites.google.com/site/oauthgoog/Home/emaildisplayscope

关于oauth - 要求 Google 返回电子邮件地址作为 OAuth 的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3128981/

相关文章:

android - Android 手机上的 OAuth 安全问题?

c# - DotNetOpenAuth:如何实现简单的 OpenId 提供程序?

c# - 如何使用 DotnetOpenAuth 检索配置文件 ID

openid - 向 OpenID 提供商请求电子邮件地址

asp.net-mvc-4 - OAuthWebSecurity.VerifyAuthentication IsSuccessful 返回 false 如何确定原因?

python - python 中的 oauth2

ios - Twitter OAuth 在 iOS 应用程序上抛出 'Desktop applications only support the oauth_callback value oob'

.net - 本地主机上使用 DotNetOpenAuth 的 OpenID 提供程序

flutter - 在 Flutter 中刷新 token

java - 使用 Java 实现 Mendeley 中的 Oauth 2