Q: Google authentication with php laravel I am creating a php laravel application that requires google oauth to work. So I created the following function:
function auth(){
   $client = new Google_Client();
   $client->setClientId($client_id);
   $client->setClientSecret($client_secret);
   $client->setRedirectUri($redirect_uri);
   $client->addScope("https://www.googleapis.com/auth/adsense.readonly");
   $authUrl = $client->createAuthUrl();
   return "<a href=\"$authUrl\">Connect Me</a>";
}

Now I want to access this $client variable when the user comes back on my site. Since my Session becomes empty after the redirect, I can't use that. (maybe something to do with the response being in HTTPS).
The two options I have considered are:
1) Cookies
2) Making the redirect url have the session id as a param (not sure if this can work)
Is there any standard way to achieve this?

A: I suggest taking a look at http://oauth2-client.thephpleague.com/
There are code samples on it and it gives you good understanding of what you will need to do.
Alternatively take a look at Laravel's Socialite
