Google Plus Login API not working on production server <p>I have implemented the google plus api on development server and it works fine. I used the same code on production server. But after requesting the permission it takes a long time to return to my site and login.</p> <p>Can anyone please let me know what might be the cause. I have used oauth2.</p> <p>Below is the code I am using</p> <pre><code>&lt;?php session_start(); require_once 'googleplus/src/Google_Client.php'; require_once 'googleplus/src/contrib/Google_Oauth2Service.php'; class Webpage_UserGPlusLogin extends Webpage { public function __construct() { $temp_redirect = $_SESSION['RETURN_URL_AFTERLOGIN']; $this-&gt;title = 'User Account'; $client = new Google_Client(); $client-&gt;setApplicationName(WEBSITE_NAME); $client-&gt;setClientId(GOOGLE_PLUS_CLIENT_ID); // Client Id $client-&gt;setClientSecret(GOOGLE_PLUS_CLIENT_SECRET); // Client Secret $client-&gt;setRedirectUri(GOOGLE_PLUS_REDIRECT_URI); // Redirect Uri set while creating API account $client-&gt;setDeveloperKey(GOOGLE_PLUS_DEVELOPER_KEY); // Developer Key $oauth2 = new Google_Oauth2Service($client); if (isset($_GET['code'])) { $client-&gt;authenticate($_GET['code']); $_SESSION['token'] = $client-&gt;getAccessToken(); $redirect = GOOGLE_PLUS_REDIRECT_URI; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); // Redirects to same page return; } if (isset($_SESSION['token'])) { $client-&gt;setAccessToken($_SESSION['token']); } if (isset($_REQUEST['logout'])) { unset($_SESSION['token']); $client-&gt;revokeToken(); } if(!isset($_SESSION['email_address_user_account'])) // Check if user is already logged in or not { if ($client-&gt;getAccessToken()) { $user = $oauth2-&gt;userinfo-&gt;get(); // Google API call to get current user information $email = filter_var($user['email'], FILTER_SANITIZE_EMAIL); $img = filter_var($user['picture'], FILTER_VALIDATE_URL); $googleuserid = $user['id']; $given_name = $user['given_name']; $family_name = $user['family_name']; // The access token may have been updated lazily. $_SESSION['token'] = $client-&gt;getAccessToken(); // If email address is present in DB return user data else insert user info in DB $this-&gt;result = UserAccount::gplus_sign_up($email, $googleuserid, $given_name, $family_name); // Create new user object. $this-&gt;user_account = new UserAccount($this-&gt;result['id'],$this-&gt;result['email_address'],$this-&gt;result['password'],$this-&gt;result['confirmation_code'],$this-&gt;result['is_confirmed'], $this-&gt;result['first_name'], $this-&gt;result['last_name']); $_SESSION['gplus_email_address'] = $email; $_SESSION['gplus_first_name'] = $given_name; $_SESSION['gplus_last_name'] = $family_name; $_SESSION['gplus_id'] = $googleuserid; $_SESSION['gplus_profile_pic'] = $img; $_SESSION['email_address_user_account'] = $email; } else { $authUrl = $client-&gt;createAuthUrl(); } } if(isset($temp_redirect)) header("Location:".$temp_redirect); else header("Location:/"); } } </code></pre> <p>Thanks in advance</p>