Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential

Rana Ghosh picture Rana Ghosh · Oct 3, 2017 · Viewed 30.6k times · Source

I am trying to update Google sheet values.

"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential."

I want to do this using API key not outh 2.0

Can anyone have any suggestions.

Answer

noogui picture noogui · Oct 4, 2017

Not possible. You need to use the OAuth login as indicated here in spreadsheets.values.batchUpdate:

You can see on the authorization part that it uses OAuth scopes, therefore it follows that it uses OAuth not API KEY:

Authorization

Requires one of the following OAuth scopes:

https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets