THAPA TECHNICAL

HOUSE OF WEB DEVELOPERS AND TECHNOLOGY.

config.php page code for google oAuth Login in PHP

config.php page code for google oAuth Login in PHP


<?php

//start session on web page
session_start();

//config.php

//Include Google Client Library for PHP autoload file
require_once 'vendor/autoload.php';

//Make object of Google API Client for call Google API
$google_client = new Google_Client();

//Set the OAuth 2.0 Client ID
$google_client->setClientId('Your Clint ID.apps.googleusercontent.com');

//Set the OAuth 2.0 Client Secret key
$google_client->setClientSecret('Your Client Secret Key');

//Set the OAuth 2.0 Redirect URI
$google_client->setRedirectUri('Your exact location where you want the code to be run');

// to get the email and profile 
$google_client->addScope('email');

$google_client->addScope('profile');

?> Close your php here

3 comments: