Authentication error with Service Account and Google Sheet API

I am trying to create a new REST API resource to request the API. I want to authenticate with a new Service Account I just created.

I copied and pasted the Service Account key payload
Screenshot 2023-11-27 at 16.29.43

When running a simple request, I get the following error:

  "error": {
    "code": 401,
    "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See",
    "status": "UNAUTHENTICATED"

which makes me think that something is missing maybe in the headers? However, I cannot find helpful documentation about using Service Account in REST API resources.

I found this:

If you select Service Account , you need to provide a Service account key .

And here there is nothing about Service Account.

Any idea where to look to make it work?

I'm getting the same response trying to use the Google Drive API with a service account.

Hey all, some more context on this issue here. While the Service account authentication currently works for cloud functions, we are working on options to allow this for the Drive API etc.