Google: Permission denied to generate login hint for target domain NOT on localhost

Okay, I figured this out. I was using an IP address (as in "http://175.132.64.120") for the redirect uri, as this was a test site on the live server, and Google only accepts actual urls (as in "http://mycompany.com" or "http://localhost") as redirect uris.

Which, you know, THEY COULD HAVE SAID SOMEWHERE IN THE DOCUMENTATION, but whatever.


I know this is an old question, but it's the first result when you look for the problem via Google, so I'll share my solution with you guys.

When deploying Google OAuth service in a private network, namely some IP that can't be accessed via the Internet, you should use a magic DNS service, like xip.io that will give you an URL that your browser will resolve to your internal IP. You see, Google needs to be able to reach your authorized origin via your browser, that's why setting localhost works if you're serving it on your computer, but it won't work when you're deploying outside the Internet, as in a VPN, intranet, or with a tunnel.

So, the steps:

  1. get your IP address, the one you're deploying at and it's not a public domain, let's say it's 10.0.0.1 as an example.
  2. add http://10.0.0.1.xip.io to your Authorized Javascript Origins on the Google Developer Console.
  3. open your site by visiting http://10.0.0.1.xip.io
  4. clear your cache for the site, if necessary.
  5. Log in with Google, and voilà.

I got to this solution using this answer in another question.


If you are using http://127.0.0.1/projects/testplateform, change it into http://localhost/projects/testplateform, it iwll work.