Search code examples
google-apioauth-2.0google-drive-apigoogle-drive-realtime-api

Error: invalid_client no registered origin


I have installed the Google Drive Realtime API sample files on my web server, following these instructions, including generating a client_id in the Cloud Console and inserting it into the index.html file.

When I visit that page and click the button to authorize the app, it pops up with a new window and shows:

Error: invalid_client
no registered origin

The Request Details are:

openid_connect_request=true
cookie_policy_enforce=false
scope=https://www.googleapis.com/auth/drive.install https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/plus.me
response_type=token
access_type=online
redirect_uri=postmessage
proxy=oauth2relay865404532
origin=http://mywebsite.com
state=264939258|0.165356673
display=page
client_id=1077585001321.apps.googleusercontent.com
authuser=0

I can't see any other client_id that I should be using in the Cloud Console. Does anybody know how to overcome this error? Thanks for your help.


Solution

  • In the new Google API Console, configure your OAuth2.0 authorized origins from

    Your Project > APIs & auth > Credentials
    

    You might need to add a new Client ID specifically for a web application (I did because the default was for AppEngine)

    Create Client ID > Web Application > Authorized Javascript origins
    

    If you are running on a local dev server, just add the exact URL such as :

    http://127.0.0.1:9000