如何使用google +令牌从https://www.googleapis.com/plus/v1/people/me电话获取电子邮件? [英] How to get the email from https://www.googleapis.com/plus/v1/people/me call using a google+ token?

查看:139
本文介绍了如何使用google +令牌从https://www.googleapis.com/plus/v1/people/me电话获取电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还希望从 https://www.googleapis.com/获得电子邮件plus / v1 / people / me 电话。我收到很多信息,但没有收到电子邮件。有人可以帮忙吗?

i want to get also the email from https://www.googleapis.com/plus/v1/people/me call. I receive a lots of informations, but not the email. Can anyone help?

HttpGet request = new HttpGet("https://www.googleapis.com/plus/v1/people/me?scope=https://www.googleapis.com/auth/userinfo.email");
request.setHeader("Authorization", "Bearer <access_token>");
HttpResponse response = client.execute(request);


推荐答案

编辑:已作为改进的Google+登录的一部分进行了更新在2013年12月的选项中-您现在可以获取包含Google+个人资料回复的电子邮件地址。

Updated as part of the improved Google+ Sign-In options in December 2013 - you now can get the email address with the Google+ profile response.

只要拥有电子邮件或 https://www.googleapis.com/auth/plus.profile.emails.read 范围。请参见 https://developers.google.com/+/web/people/#retrieve_an_authenticated_users_email_address 了解详情。

You will get the email from this endpoint as long as you have the email or https://www.googleapis.com/auth/plus.profile.emails.read scopes. See https://developers.google.com/+/web/people/#retrieve_an_authenticated_users_email_address for details.

var request = gapi.client.plus.people.get( {'userId' : 'me'} );
request.execute(function(person) {
  if(person['emails']) {
    console.log(person['emails'][0].value);
  }
});

这篇关于如何使用google +令牌从https://www.googleapis.com/plus/v1/people/me电话获取电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆