Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google API authentication: Not valid origin for the client

When making an auth request to the Google API (gapi), it's returning false on the checkOrigin.

I have removed any client id's or anything that would link directly to my account and replaced it with a regex indicating what the data is for reference.

Url: https://accounts.google.com/o/oauth2/iframerpc?action=checkOrigin&origin=https%3A%2F%2Flocal.tools&client_id=(\d{21})

My origin url is a local url, which is https://local.tools

Result: {valid: false}

I'm using the example found here without deviation (except for replacing clientid with my 21 digit clientid): https://ga-dev-tools.appspot.com/embed-api/third-party-visualizations/

The items I'm trying to display show up nicely on the demo site, but aren't getting past the Not valid origin for the client error on my local.tools site.

like image 808
Francis Lewis Avatar asked Mar 02 '17 21:03

Francis Lewis


People also ask

How do you register the origin for your project client ID?

Please go to https://console.developers.google.com/apis/credentials, click on the 'edit' button of your Client ID, and add your site to the origin whitelist.

How can I get Google OAuth client ID for localhost?

OAuth client ID.For Application type, select Web application. For Name, enter a name for the OAuth web client. For Authorized JavaScript origins, click Add URI and enter the HTTP origins that host the Google Workspace Migrate platform (for example, http://localhost:5131). Click Create.


1 Answers

Clear your browser cache. Started getting this error in Chrome and then I created a new client id and was still getting the issue. Opened firefox and it worked, so I cleared the cache on Chrome and it started working.

like image 126
iamcootis Avatar answered Oct 06 '22 20:10

iamcootis