Search code examples
laravelhomesteadgoogle-signinlaravel-socialite

How to setup the redirect url from Homestead using Socialite with Google?


When you try to setup Socialite for Laravel, using Homestead (here on Ubuntu), the "redirect url" needed for Google Sign-In are always marked as 'bad' :

Error: invalid_request

Invalid parameter value for redirect_uri: Non-public domains not allowed: https://homestead.test/google/callback

And trying to add http://homestead.test/google/callback or http://192.168.10.10/google/callback end up either as a :

"Non top level domain supported"

or just with

"Non valid URI"

Is it hopeless due to Google restrictions or is there any way to do so ?


Solution

  • Ah found ! Short answer :

    Edit your /etc/hosts with a real tld domain that you bypass :

    192.168.10.10   example.com
    

    And then tell Google to accept it :

    https://console.developers.google.com/apis/credentials/consent?project=xxx https://console.developers.google.com/apis/credentials?project=xxx