Error code 403 in Google+ api

2019-01-15 00:54发布

问题:

I got "error": { "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", "extendedHelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." } When i try to fetch User Profile in Google+ api by https://www.googleapis.com/plus/v1/people/me URL String.If anyone have any suggestion then please tell me as soon as possible.Thanks in advance for your time.

回答1:

That message implies that you haven't set up a Google APIs console project.

  1. Create a Google APIs Console project
  2. On the Services pane, enable all of the APIs that your project requires.
  3. On the API Access pane, click Create an OAuth 2.0 client ID. A dialog opens. Fill in your project's information. Click Next
  4. Choose the appropriate application type. Based on the tags you used for this post, I am guessing this is an iOS project so select Installed application.
  5. Enter your bundle ID. You don't need to enter an App Store ID until your app is listed there.
  6. Click Create Client ID.

You will see the client ID and client secret values. You will use these values to enable communication with your project and the Google APIs.

If you aren't already using it, see the Google+ iOS SDK and documentation for a full walk through. The task called "write moments" is similar in implementation and demonstrates how to connect to and use the Google+ REST APIs from within an iOS project that uses the SDK.

You'll need to specify the scope of plus.me to get the profile information.



回答2:

I just want to add a little information here in the rare case that someone runs into this problem.

I have an organization (ORG). I created a second channel (SC) with some playlists, that referenced videos from ORG.

I made the mistake of assuming that because ORG owned SC, that I could use the same oauth credentials from ORG to access both. I was wrong.

I switched credentials and was confused when I could access the playlists but not the videos. Again, I needed credentials for each one separately to access the resources on the respective channel.

Lame, but that was how it was.



回答3:

BrettJ's answer will cover most of the bases. However, you will also get this error - even when your credentials are properly authenticated - when the scope is not properly set up. I would check the scope setting in your OAuth dance. Make sure your user is permitted to do the thing your code is trying to help them do.



回答4:

On top of what BrettJ has mentioned, it is important to send the authorization header for the request done to fetch UserProfile in google+ API.

For example, Add the following header key: Authorization value: Bearer ya29.Ci-cA_CywoVdVG#######



回答5:

I got the same error and after much hunting I found that, in my case, the Authorization header with the access token was not set. Set Authorization: "Bearer <YOUR_ACCESS_TOKEN>" in the header of the request of EVERY Google API call.