0

I turn out that google play store stores statistics related data in google cloud. It creates the required buckets and updates the file daily as it is required. I am trying to download those file in google app script and update the Google sheet with data.

From google documentation, there are 2 ways to do so.

  1. With Oauth
  2. API KEY.

So far I was able to download file with Oauth but with API KEY I am getting the error

There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.

I have created the API KEy with no restrictions. Also enabled the Cloud Storage JSON api and Cloud storage API.

1 Answers1

0

I did the same in the following way:

Get Oauth token:

public string GetOAuthToken()
{
return googleCredential.UnderlyingCredential.GetAccessTokenForRequestAsync("https://accounts.google.com/o/oauth2/v2/auth", CancellationToken.None).Result;
}

I am able to make a request.

Reference:

How to download files in Google Cloud Storage using rest api

https://stackoverflow.com/a/53955058/4345389

Thanks

Jayoti Parkash
  • 868
  • 11
  • 26
  • Thanx Jayoti, My question is specific to the API key, not Oauth. Although I have completed the given task using Oauth. Secondly i was trying to do this in AppScript so resources were quite limited. – Somesh Kumar Mar 12 '19 at 10:55