Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing google+ sign in button to localhost with google API

I am trying to implement the Google+ log in /sign in button on a website I'm coding through Sublime Text2 and running through Apache. I'm VERY new to web development and using localhost / http://127.0.0.1 .

So my questions comes in because when I have the button in the "index" Chrome HTML Document, it runs fine and I can log in with my google+ account.

BUT, if I have the button in a webpage linked to it (a new document "signin" Chrome HTML Document) the log in does not go through. It will pull up my accounts but it won't let me log in completely.

ERROR Error: origin_mismatch

I think I have to change something in my JavaScript Origins in my Credentials in my API's and Auth, but it won't let me add something like http://localhost/signin.html It says

Origins URIs must not contain a path: http://localhost/signin.html

How can I give this webpage access??

Thank you!

like image 349
Clark Avatar asked Feb 22 '15 22:02

Clark


People also ask

How do I add a Google sign-in button?

To create a Google Sign-In button with custom settings, add an element to contain the sign-in button to your sign-in page, write a function that calls signin2. render() with your style and scope settings, and include the https://apis.google.com/js/platform.js script with the query string onload=YOUR_RENDER_FUNCTION .

Is Google API sign free?

Google Sign-in is a free service. To use Google sign-in you have to use Google's Firebase authentication service.

How does Google OAuth work?

OAuth 2.0 allows users to share specific data with an application while keeping their usernames, passwords, and other information private. For example, an application can use OAuth 2.0 to obtain permission from users to store files in their Google Drives. This OAuth 2.0 flow is called the implicit grant flow.


2 Answers

What was happening to me was that the UX on the redirect URI / authorized origin was confusing me and the "save" button wasn't working. Just because the item has been added to the list, doesn't mean it has been saved. Also, ensure you've added the correct port if it is non-standard.

enter image description here

like image 172
Reuben Tanner Avatar answered Sep 28 '22 22:09

Reuben Tanner


Origins URIs must not contain a path: http://localhost/signin.html

http://localhost/signin.html without a path becomes http://localhost. You must edit your application in the Google Developers Console so that it does not have a path.

like image 43
abraham Avatar answered Sep 28 '22 21:09

abraham