Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
956 views
in Technique[技术] by (71.8m points)

http - "PERMISSION_DENIED" on Google Spreadsheet REST API v4

I try to read data from google sheet via http. I use v4 google spreadsheet api:

https://sheets.googleapis.com/v4/spreadsheets/1MZJEOzkzy5iJ9HPy2GU-Ky3vdaIzGGDQH8BMt4n3OGI/values/Sheet1!A1:D5

I get:

{
  "error": {
    "code": 403,
    "message": "The request cannot be identified with a client project. Please pass a valid API key with the request.",
    "status": "PERMISSION_DENIED"
  }
}

Sheet is published online and everyone can edit it. It works on api v3 too.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First, make sure you have a permission to call this spreadsheet and you enable the Sheets API in your developer console. You can also try to change the privacy settings of this spreadsheet to public and checked if you can access it now. This 403 error is usually caused by incorrect or missed some configuration in Authorizing Requests. If you authorizing requests with OAuth 2.0, make sure you use the proper scope with it.

For more information, you can check this thread on how to debug your Google OAuth 2.0 token when you get HTTP 401s or 403s


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...