[英]How can i get an users email id using Google Oauth2 Credentials of ‘Service Account’?
How can I get an Google's user basic information using access token? 如何使用访问令牌获取Google的用户基本信息? Access token which is generated by an service account of Google.
由Google的服务帐户生成的访问令牌。 While I trying to get user info by using https://www.googleapis.com/oauth2/v1/userinfo?access_token=xxxx .. which is returning the service accounts email and service accounts id.. which does not returning the user's actual email id(anu@gmail.com) .. How can I get the user's actual email id( anu@gmail.com ) by this service accounts access token?
当我尝试通过使用https://www.googleapis.com/oauth2/v1/userinfo?access_token=xxxx ..来获取用户信息时,该信息将返回服务帐户的电子邮件和服务帐户ID。而这不会返回用户的实际信息email id(anu@gmail.com) ..如何通过此服务帐户访问令牌获取用户的实际电子邮件id( anu@gmail.com )?
Thanks in advance.... 提前致谢....
Assuming it's a Google Apps account you want and the domain has granted your service account permission for the profile scope, you just need to use the sub= parameter to set the user you want an access token for. 假设您要使用的是Google Apps帐户,并且该域已授予您的服务帐户对配置文件范围的权限,则只需要使用sub =参数来设置您想要访问令牌的用户。 Then user profile calls will return data on the user instead of the service account.
然后,用户配置文件调用将返回用户而非服务帐户上的数据。 See delegating domain-wide authority .
请参阅委派域范围的权限 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.