0

I'm trying to use the slides rest APIs to retrieve a presentation. I've tried to read my own simple presentation as well as the one in the samples. Right now I'm just trying to enter the following request. https://slides.googleapis.com/v1/presentations/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc?fields=slides.objectId&key=*********

It doesn't matter if I pass my API key in or not, I consistently get the following issue "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",

I've done similar calls with the sheets API with no issues.

Any help explaining why my key is being ignored is greatly appreciated. Thanks!

2 Answers2

0

I will presume that your authentication access token has not expired. If it has, then you will need to refresh it using your refresh token.

If you do not have a refresh token, then you will have to go through the whole process of getting a new access token, and refresh token through OAuth2 authentication chain process.

Once all that is done, then you can make your slide download request.

I believe that your access token has expired, that is why you are getting the error message.

Blaise
  • 11
  • 2
0

There are two main ways to authorize requests in Slides API : using API Keys or oAuth 2.0. Note that if you use an API Key the presentation must be public as explained in the documentation. If the presentation is not made public then you will not be able to use the API Key and instead you will need to use an oAuth 2.0 token.

Depending on your case scenario consider if you want to make your presentation public (in which case you can use API Keys) or not (in which case you will need to use oAuth 2.0).

halfer
  • 19,824
  • 17
  • 99
  • 186
Mateo Randwolf
  • 2,823
  • 1
  • 6
  • 17
  • Thank you for your response. Right now I'm just testing to see if using the Rest API will solve my needs so I'm using the API Key vs oAuth 2.0. I have a presentation public as well as trying to access the [example presentation](https://developers.google.com/slides/samples/reading) using the the API-Key. I know my key is good because it works great with the Sheets API. I can't seem to get anything in the Slides API working with the API key. Is it really supported or does oAuth have to be used? – Chris B Jan 13 '21 at 14:04
  • So is your presentation public? And if so, what are the sharing settings you have set (anyone can access as editor, viewer, etc)? Did you make your publication public by clicking under ```Publish to the web```? Is your API key restricted to only Google Sheets? – Mateo Randwolf Jan 14 '21 at 09:37