Google API: Not a valid origin for the client: url

2019-03-14 06:26发布

I need help. I don't found an answer to my question. I tried googling and I tried asking on other sides but I never found an answer.

I'm working with the google API (Youtube data API) and I use the example code from the google side the code it works I'm pretty sure about that. I got an error when i try to start the Script:

details: "Not a valid origin for the client: "MyURL" has not been whitelisted for client ID "MyID". Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."

error: "idpiframe_initialization_failed"

The problem i whitelisted my Website and it's accepted. i don't know what is wrong. What should i do to "whitelist" my Domain (It's whitelisted)

And another question. I did not search for an answer on this question before.

I think it's possible that I can use the code on Localhost, I think I must whitelist my localhost address or something like this. But whitelisting does not work.

  • DreamGamer

9条回答
2楼-- · 2019-03-14 06:58

Had the same problem and here's how I solved it:

  1. Activate both Analytics and Google Plus APIs on your project
  2. Create new OAUTH 2.0 client credentials
    • Add the Authorized Javascript Origins under Restrictions section
  3. Use the new client id.

Enjoy.

查看更多
够拽才男人
3楼-- · 2019-03-14 06:58

For me, it worked without adding any of the additional APIs like google analytics. Just make sure to add the complete clientid and open the app in incognito window to avoid saving the cache. If already have opened the app in regular window, 1- Close all tabs that app is open at. 2- Clear the cache and cookies. In chrome, its in Settings --> Passwords and forms -> Clear Browsing data -> Advanced (tab) -> select a) Cookies and other site data and b) Cached images and files 3- Open a fresh incognito window and test your app.

查看更多
Viruses.
4楼-- · 2019-03-14 07:00

I cleared cache. Started working then.

In Chrome: Settings --> Advanced --> Clear browsing data --> Cached images and files

查看更多
看我几分像从前
5楼-- · 2019-03-14 07:01

I believe this has to do with caching, try to Go to your browser and clear the cache, try: in chrome, > setting > advanced > clear browsing data :>: cached images and files.

查看更多
贼婆χ
6楼-- · 2019-03-14 07:04

I also followed the instructions in the quickstart example, Had the same problem, tried all the solutions suggested here to no avail, tried everything I could imagine but it didn't help.

Finally saw that I copied the CLIENT_ID with a space at the end.

  var CLIENT_ID = '44********-*****************.apps.googleusercontent.com ';

Once I fixed this (removed the extra space) it worked.

I guess the error message is not very precise in this case. Hope this helps.

查看更多
forever°为你锁心
7楼-- · 2019-03-14 07:10

Clearing the cache did the trick for me

查看更多
登录 后发表回答