Search code examples
apioauth-2.0google-oauth

Google Oauth and API quotas consumption


I am trying to understand the API consumption count for Google services & quotas limitations (and where it would be applied).

I am requesting user to synched their personnal Google account via my application using GoogleOAuth2.0 authentification.

When I am going to use their authentification to make requests in their behalf, is the API quotas will be reduced from their own accounts ? or from my global account where the OAuth2.0 is created ?

For example Google Analytics have limits of 50k/day requests is that limits applied to only One customer that synch and I am using his credit or the 50k/day is applied on my own application account ? (hence limiting my ability to manage multiple clients).

Thanks for the precision maybe it's better that the user create a serviceaccount and I connect with it instead.


Solution

  • API consumption is charged against the quota of the project that contains the OAuth Client ID.

    Some of a project's quotas are measured per user (for ex, Queries per minute per user). To protect against a situation where a single user (or a small number of users) consume too much of the overall quota, you can pass the userQuota parameter as a hint:

    Identifies the user that the per-user quota will be charged against. If not specified, the authenticated principal is used.

    A client can also pass the extra parameter $userProject to (voluntarily) charge against a different project's quota. The caller must have serviceusage.services.use permission on the project for that to work.