2015-08-08 32 views
0

因此,我刚刚开始使用Google的Gplus API来开发我正在开发的应用程序,并且一切正常,但我对Google的响应对象似乎拥有完全随机的双字符字符串作为其属性键的事实感到困惑。例如,这里就是我得到:为什么Google的API响应对象的属性键是随机的双字符字符串?

WE {El: "100327378902537923764", Ka: Object, wc: PG} 
El: "100327378902537923764" 
Ka: Object 
wc: PG 
Ka: "100327378902537923764" 
Ld: "Thomas Moore" 
wc: "[email protected]" 
zt: "https://lh6.googleusercontent.com/-example/AAAAAAAAAAI/AAAAAAAAMPA/Vo75ASRTN_k/s96-c/photo.jpg" 

我使用的JavaScript SDK和角度。如果任何人有这个

编辑一个合理的解释很好奇:这是我提出要求:

gapi.auth2.getAuthInstance().then(function (googleAuth) { 
      googleAuth.signIn({ 'scope': 'profile email' }).then(function (result) {} 
+0

你在做什么具体要求吗? – jfriend00

+0

看起来您正在使用私有API,而不是[已记录的公共API](https://developers.google.com/+/)之一。 – abraham

+0

我不明白你的意思是私人API ... googleAuth.signIn()是一个文档化的功能。你能澄清你的意思吗? – tcmoore

回答

3

谷歌公开通过方便的getter方法这些属性。例如,为了获得个人资料的信息,您可以使用gapi.oauth2.BasicProfile对象的以下干将:

// profile id 
gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile().getId(); 
// profile name 
gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile().getName(); 
+0

“方便”,这当然是一个意见 – Gausie

相关问题