16
votes

I am trying to integrate Google login in my website ..

I am following this example: https://developers.google.com/identity/sign-in/web/

I generated client id for my project and replaced it in above code, I keep getting this error:

  1. That’s an error.

Error: invalid_request

Permission denied to generate login hint for target domain.

5
What is your domain? - DaImTo

5 Answers

36
votes

I ran into this issue while doing local development. Make sure when running your project locally that you launch "http://localhost" rather than "http://127.0.0.1", "http://0.0.0.0", etc...

3
votes

For me, I had to the developer console, to the project which was using the analytics api, and then I had to add localhost:port to both the "authorized Javascript origins" and the "authorized redirect URIs". In my scenario I was using port 9002 How to

1
votes

Just my 2 cents. I am on a local developer machine behind Browsersync proxy. I could only make it work using the non-proxied localhost name defined in etc/hosts file like this: 127.0.0.1 my-site.localhost.

Then I put http://my-site.localhost into 'Authorized Javascript origins' field and http://localhost into 'Authorized request URIs' one.

Then the error disappeared and authorization worked.

0
votes

If you are using actual IP address(http://your IP address:8080/) for redirect URL, then it would throw this error. Google auth API only accept domain name as(www.mydomain.com) redirect URL.

0
votes

Try the following dns name localtest.me for local development.