Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
Using Google Sheet's v4 JSON Endpoint with my API but still getting "Unauthorized" message

I am trying to get a simple JSON package from putting the URL of my Google spreadsheet so I can use it on my webpage; I am using my Google Cloud Console API as it is said on the documentation of the v4 Google API format, but I still get the error of "Unauthorized API"

Documentation: https://developers.google.com/sheets/api/guides/migration#v4-api

I am using this URL: https://sheets.googleapis.com/v4/spreadsheets/SHEET_ID/values/Sheet1?key=API_KEY

My google sheet is set as published on the web. And also I am the creator of the google sheet.

What could I be missing? I am new to API's!

Message

First Edit: Answering the comment of ABDULLOKH MUKHAMMADJONOV Here is the code I am using to make a GET request to the google sheet, you can see the Sheet ID is there, and also the API of the google cloud platform.

fetch("https://sheets.googleapis.com/v4/spreadsheets/1S652uS2FLVoZ1m3apb6R4H783v6GkV58HbQ6Idec5aY/values/Sheet1?key=AIzaSyCpFZ7mcqMNc6Q_bP6h1kCEfAi6c_fd8AM", {"method": "get"})
.then( (httpResponse) => {
    if (httpResponse.ok) {
    console.log(httpResponse.json());
    return httpResponse.json();
    } else {
    return Promise.reject("Fetch did not succeed");
    }
} )
.then(json => console.log(json.someKey))
.catch(err => console.log(err));

This code is from the Wix code editor.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The caller doesnt not have permissions

Means that the user you are authenticated as does not have permission to do what it is you are trying to do.

The method

https://sheets.googleapis.com/v4/spreadsheets/SHEET_ID/values/Sheet1?key=API_KEY

I believe is this method spreadsheets.values/get if you check the documentation you will notice that it requires authorization with one of these scopes

enter image description here

You appear to only be sending an api key. You need to be authorized to access that sheet. You cant access it with an API key that only grants access to public data.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Ok, so I investigated about the OAuth 2.0 authentication and authorization for using Google Sheet's REST API. I added one of the needed scopes.

But I am stuck at the point on how to do the authorization process...

I am looking at this google documentation - How to use Google OAuth 2.0 authorization

But I haven't been able to get to the answer I seek. I am stuck at the part where it says "When your application needs access to user data, it asks Google for a particular scope of access." I do now know how to code this request or to do this request through the Insomnia software.

I am trying to do the GET request with a wix testing website, and also with Insomnia, but I haven't been able to achieve it.

These are the images from Insomnia, which tell me "Invalid authorization URL"

Insomnia's OAuth 2.0 authentication parameters

Insomnia's API Query parameter

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda