Please ensure that the client is sending referer or use the API Console to remove the referrer restrictions.Google Calendar API

Viewed 6747

I have to try get google calander events through javascript.

in google console, I create a project, API Key, OAuth client id and enable API for Google Calendar.

I have set Authorized javascript origin as http://localhost.

gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: false }, handleAuthResult);

two days before working fine but yesterday it didn't worked and sohwing the below error.

The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referrer restrictions.

Error Message Are

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "ipRefererBlocked",
    "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.",
    "extendedHelp": "https://console.developers.google.com/apis/credentials?project=698394884872"
   }
  ],
  "code": 403,
  "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions."
 }
}
1 Answers

I faced the same problem when hitting a YouTube API through postman.

Url -

 https://content.googleapis.com/youtube/v3/videos?id=H61xC_BUros&part=snippet%2CcontentDetails%2Cstatistics&key=

Error faced -

{
    "error": {
        "errors": [
            {
                "domain": "usageLimits",
                "reason": "ipRefererBlocked",
                "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.",
                "extendedHelp": "https://console.developers.google.com/apis/credentials?project=292824132082"
            }
        ],
        "code": 403,
        "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referrer restrictions."
    }
}

Working Solution -

Add the following (in headers when hitting through postman)

Referer : https://explorer.apis.google.com 
Related