How to call https://www.googleapis.com/plus/v1/people/me at google

前端 未结 6 2215
感情败类
感情败类 2020-12-28 23:04

I am developing an Android application and need to get the \"me\" info from google but I always ends up in either response code 401 or 403. What am I doing wrong? Here is my

相关标签:
6条回答
  • 2020-12-28 23:07

    Generate a new auth token and secret for your application and try again.

    That might solve your problem, but your daily retry limit might be exhausted...

    I had the same issue you're having.

    0 讨论(0)
  • 2020-12-28 23:10

    Why don't some of you try to go to the Google Console. In this way you will be able to have access to to the tools you need to rectify at least 403 forbidden problems. DMC

    0 讨论(0)
  • 2020-12-28 23:10

    You are using HTTP at the moment, but you are actually calling a the site over HTTPS. Either use a secure connection procedure or use the http:// address.

    0 讨论(0)
  • 2020-12-28 23:15

    The issue is regarding the simple api key passed into the request.

    If the key parameter isn't included in the request, or if the Google+ API wasn't activated for that project, you'll get the error: "Daily limit exceeded. Please sign up".

    To solve this problem, you need to do the following:

    • Visit the Google API Console here: https://code.google.com/apis/console/?api=plus
    • Under the Services panel, make sure the Google+ API is turned "on".
    • In the APIs console, click API Access in the left menu.
    • Copy the API key presented towards the bottom.
    • Include this API key in your HTTP request.
    GOOGLE_ME_URL + "?access_token=" + authToken + "&key=" + MY_SIMPLE_API_KEY
    
    0 讨论(0)
  • 2020-12-28 23:17

    You just need to enable Google+ API in console.

    0 讨论(0)
  • 2020-12-28 23:28

    Most of the newer Google APIs have quotas (like daily usage limits) and some even have billing support (where you get billed per API call). These quotas and billing are calculated per developer's project, and not on a per-end-user basis, so Google needs to know which app to assign your API usage.

    API clients using Google's OAuth 2.0 are typically required to register and get a client ID and client secret.

    This client ID and client secret are returned by the Google APIs console: code.google.com/apis/console.

    You then use these values in your application, and this identifies your app and allows Google to assign your API usage to your developer account/project.

    In the AccountManger interface you're using, there is no client ID passed by your app, so Google can't identify which developer account/project's quota to deduct for usage. It also doesn't know that the API has been properly enabled (TOS accepted, etc) by you as a developer. That's why it's asking you to "please sign up" and saying the "Daily limit exceeded" (as the unregistered limit is zero requests for many APIs).

    In this scenario, it is necessary for you to pass the "key" value as you did in order to access APIs with OAuth 2.0 tokens retrieved from the AccountManager.

    0 讨论(0)
提交回复
热议问题