[Be careful] Google OAuth + Google Cloud API may not behave as expected

It cost you money instead of the end-user. which is wrong.

[Be careful] Google OAuth + Google Cloud API may not behave as expected

What this artcile is about?

When combining Google OAuth + Google Cloud API.
There are a billing issue that you should know.

so you won't get unexpected bill.
I got one. it cost me $95.15 dollar.

Well, in the end Google refund me, so it's actually cost $0,
but the point is, this refund is a "one time courtesy" (copy direactly from the email)

If you made the same mistake, Google may not refund you money

Who this article is for?


What's the goal of this article?

So you won't make the same mistake as I did.

TLDR version

When using "Google OAuth" + "Google Cloud Translation API"
You may expected that:

  1. End-user use Google OAuth to login your Web app
  1. After login success, you got "access token" from the end-user.
  2. When user want translate some text, you can use their "access token" to call Cloud Translation API on their behalf
  3. The usage would be count on User's account. and User would get charged for that usage by Google.
  4. As developer and OAuth app owner(in the Google Cloud Console) you won't get charged

But in fact, it's not how it work.
this assumption is totally wrong.
you will be charged!

If you are building a free or very cheap Web app/Desktop app,
that let user login with their google account, and then use Google Translation API.
You would lost money! more people use it, more money you lose!

I got charged $95.16 dollar for 5 millions charactor Cloud Translation usage.
(I have like 5-10 user are using it.
if you app get popular, it probably cost you more then $95.16,
maybe $950, maybe $2000, who knows.)

Let this be the lesson.

Alright, TLDR version is done. have a nice day.

Detail version (the long version)

  1. I am building an Desktop app (support macOS and Windows) that can translate subtitle file (.srt .ass .vtt file)

Here is how that Desktop app look like:

(I promise this is not an AD for my product,
I just want the reader to know what's the situation, how I get the "Google OAuth" + "Cloud API" problem, and How I eventually get refund from Google.
I am just trying to be helpful by writing down this pitfall)


  1. It support 9 different tranlsation services provider:
  • Google
  • Azure
  • Yandex
  • Amazon
  • Caiyun
  • Baidu
  • Tencent
  • Sogou
  • Xiaoniu

Here is a screenshot:

  1. End-user can sign up on provider's website.
    get an "API Key" or "Token" or whatever they call it. it just a identity.

Take Microsoft Azure for example:

copy [KEY 1] or [KEY 2]
  1. paste that "Key"

Here is an example on how to use this:

This is the Result.
left side is before, right side is after.

You can translate from any language to any langauge
(as long as the service provider support these).

For example Japanese to English.
(maybe you want watch some anime?)

Or other langauge

Alright, back to the topic.

After I got the bill of $95.16 dollar I got confused.
like: user is the one who are using Cloud Translation API,
why Google bill me?
I did everything Google Document tell me to do.
I passed in user's access token to the API.

Here is the things I tried

  1. Phone Support: didn't work
  2. Chat Support: didn't work
  3. Email Support: worked.

Email Support detail:

Email 1

Email 2

Email 3 & 4

Email 5

Email 6 & 7 & 8

Email 9

Email 10

Email 11

Email 12 & 13

Email 14 & 15

That's all

Thank you for reading. have a nice day