WheMaking REST API calls to resource: projects.timeSeries results in 403 when using service accounts

When making a REST API call to https://monitoring.googleapis.com/v3/projects/${projectId}/timeSeries , providing an access token generated from a service account results in a 403 error "This API method requires billing to be enabled". However using a token generated from an actual google account results in a 400 error, which is expected due to invalid arguments. API reference: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list

The project is not billing enabled. I understand that the error message says that the project must be billing enabled, but why though? Even if the project is not billing enabled, I'm able to make a curl request by using a google account access token, but when using a service account access token, the project suddenly needs to be billing enabled?

 

TLDR:

Project is not billing enabled, this request results in 400 error(WAI since I'm not passing any valid argmunets)
```
curl https://monitoring.googleapis.com/v3/projects/${projectId}/timeSeries -H "authorization: Bearer ${google_account_access_token}"

```

 

Project is not billing enabled, this request results in 403 error(Why)
```
curl https://monitoring.googleapis.com/v3/projects/${projectId}/timeSeries -H "authorization: Bearer ${service_account_access_token}"

```

Have tried giving the service account owner permission and providing wider scopes, this did not work. So far, enabling billing on the project work. but that does not explain why the API works when using as google account access token even if the project's billing is not enabled.


I expect the API to not respond with a 403 error stating that the project needs to be billing enabled, when using a service account access token to authenticate.

0 1 170
1 REPLY 1

Hi Amalej,
Have you made it work, can you share the workaround, as I am having same issue