· 4 years ago · Jun 10, 2021, 02:34 AM
1<?php
2
3//Include Google Client Library for PHP autoload file
4require_once 'vendor/autoload.php';
5//Make object of Google API Client for call Google API
6$google_client = new Google_Client();
7//Set the OAuth 2.0 Client ID
8$google_client->setClientId('PASTE CLIENT ID');
9//Set the OAuth 2.0 Client Secret key
10$google_client->setClientSecret('PASTE SECRET KEY');
11//Set the OAuth 2.0 Redirect URI
12$google_client->setRedirectUri('http://localhost/sample-musik/login_google.php');
13
14$google_client->addScope('email');
15$google_client->addScope('profile');
16
17session_start();
18
19?>