获得使用Google+ API的用户凭据 [英] Getting user credentials using Google+ API

查看:1340
本文介绍了获得使用Google+ API的用户凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在在我的Andr​​oid应用程序中使用,包括谷歌标志的 Google+的API。我能够考虑到的细节,从用户,但登录后我得到要求输入用户名使用电话:

I am trying to include Google sign in in my android application using Google+ Api. I am able to take account details from the user but once signed in I am getting null when requesting for username using call:

Plus.PeopleApi.getCurrentPerson(mGoogleApiClient).getDisplayName()

Plus.PeopleApi.getCurrentPerson(mGoogleApiClient).getDisplayName()

和logcat中显示:

And Logcat shows:

BasicNetwork.performRequest:意外的响应code 403    https://www.googleapis.com/plus/v1/people/me

BasicNetwork.performRequest: Unexpected response code 403 for https://www.googleapis.com/plus/v1/people/me

虽然我能够使用来获得用户的电子邮件:

Although I am able to get email of the user using:

Plus.AccountApi.getAccountName(GoogleClient.mGoogleApiClient)

Plus.AccountApi.getAccountName(GoogleClient.mGoogleApiClient)

请帮我发现我的错误

推荐答案

我已经试过同一code和它的做工精细! 所以,只要保证两件事情:

I have tried same code and its working fine! So, just ensure two things:

1)注册您的数字签名的.apk文件的下面公证书在谷歌的API Console.Link:

1)Register your digitally signed .apk file's public certificate in the Google APIs Console.Link below:

https://developers.google.com/+/mobile/android/getting-started#step_1_enable_the_google_api

2)请确保您已经添加了谷歌+ API访问,并客户端密钥创建与SHA1。
休息是好的。

2)Make sure you have added the google+ api access and have client key created with SHA1.
Rest is fine.

这篇关于获得使用Google+ API的用户凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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