Search code examples
google-cloud-platformgoogle-kubernetes-enginebilling

Contacting resource: projects using REST API requests.timeSeries yields 403 when service accounts are used


403 error message appears for the service account:

"This API method requires billing to be enabled"

However, a 400 error is returned when attempting to use a token generated from a real Google account.

When I use a Service account access token, the project needs to be activated for billing purposes.

Why it is asking billing activation for this API?

Tried multiple ways to resolve this.

It was unsuccessful to grant the service account owner permission and provide broader scopes. Up to this point, empowering charging on the undertaking work. However, even if the project's billing is disabled, that does not explain why the API works when used as a Google account access token.


Solution

  • If you are getting below error Identifying what exactly went wrong and follow this official document if you are experiencing a 403 error when utilizing a service account:

    The HTTP 403 error is usually caused by the service account not having the necessary rights to access the backend service. The permissions linked to roles awarded to the service account you used to establish the API configuration are present in a deployed API. if the backend service and API are defined in the same Google Cloud Project.

    Make that the role required to access the backend service, or the Editor role, is assigned to the service account.Make that the service account has the Cloud Function Invoker role given to it, for instance, if the backend service is implemented using Cloud Functions.

    You can fix the 403 error "This API method requires billing to be enabled" that you are receiving by following the steps below:

    Google Cloud has made it essential to enable billing and disabled the free use of APIs. However, in order to activate service, billing needs to be activated, therefore this won't function on a free account. This is the cause of the 403 error as well. You are now encountering an issue as a result of your failure to include 'Billing Account' in the project you established.

    Under the Billing Projects page, you can associate your project with a billing account.After doing so, give it some time.At https://console.cloud.google.com/project/_/billing/enable, you can activate a billing.you can activate a billing.

    For additional details on the procedures to enable charging and API, see this document. You can also take a quick look at the troubleshooting document to figure out how to fix any difficulties.