Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to test Google social login locally?

I want to test the Google Social login system on my local machine. However when I create a new OAuth button: 'Create New Client ID' it requires me to fill in the Authorized redirect URI which needs to be a valid address (ends with .com or .org).

Obviously when we develop locally we don't have the .com or .org at the end. I have a virtualhost setup... and my address to my local development is mywebsite.local

Is there a way to input the redirect URI to be mywebsite.local without receinv the error:

Invalid Redirect: http://mywebsite.local/login/auth must end with a public top-level domain (such as .com or .org)

like image 704
jonprasetyo Avatar asked Oct 03 '14 17:10

jonprasetyo


People also ask

Does OAuth work on localhost?

To test a web OAuth client you can still use a localhost deployment, provided you have administrator (superuser) permissions to modify the local lookup table for hostnames.

Is login with Google free?

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


2 Answers

You can set "Authorized redirect URI" to local IP (like http://127.0.0.1/callback), it's working fine for me.

What really agonizing is that google don't allow user to config an external IP (let's say your server IP like 99.99.99.99) as "Authorized redirect URI", google want the "Authorized redirect URI" to end with a public top-level domain (such as .com or .org).

like image 146
GoTop Avatar answered Sep 27 '22 17:09

GoTop


Further to pinoyyid's answer, here's what you'd want in your /etc/hosts file.

0.0.0.0 mywebsite.com 

I put new rules after everything else that's already in there.

you can then access your development site at mywebsite.com and enter the correct redirect URL in the Google Developer's Console.

like image 20
Tim Fletcher Avatar answered Sep 27 '22 19:09

Tim Fletcher