credential_page_library:48 [GSI_LOGGER]: The given origin is not allowed for the given client ID

250 Views Asked by At

I am trying to get google oauth working on my php webapp. I'm in dev, on a centos LAMP environment with a URL that is configured to http://centos-myapp.com via /etc/hosts on Windows.

On https://console.cloud.google.com/apis/credentials/oauthclient I have set up a clientid for my app using the http://centos-myapp.com [Authorised Javascript orgins] URL,

and a dummy Authorised redirect URIs url to http::/localhost/index.php (as I can't seem to use http://centos-myapp.com ... as it wanted https)

When I run the http://centos-myapp.com page - I see the "Sign in with Google" button from the g_id_onload structure

 <div id='g_id_onload'
      data-client_id='$google_clientId'
      data-login_uri='http://centos-myapp.com'
      data-auto_prompt='false'>
 </div>
 <div class='g_id_signin'
       data-type='$googleLoginType'
       data-size='$googleLoginSize'
       data-theme='$googleLoginTheme'
       data-text='$googleLoginText'
       data-shape='$googleLoginShape'
       data-logo_alignment='$googleLoginType'>
 </div>

and the js:

<script src='accounts.google.com/gsi/client' async defer></script>

but when I click on this button I get the expected new window - but it's empty and the console reads: m=credential_page_library:48 [GSI_LOGGER]: The given origin is not allowed for the given client ID.

Am I doing something wrong? Am I not allowed to have a dev environment not named localhost?

NOTE: I had this working on a WAMP localhost environment, but since moving to a DEV LAMP with a non localhost URL then this seems to have stopped working.

NOTE2: I have been able to get this to work by making my LAMP environment http://localhost (port 80) (but not http://localhost:81) - but this then presents me with the inability to run multiple different projects as they really want to have different URLs

0

There are 0 best solutions below