<?php
$clientID = '908446786775-57j76m9i42r6kgihtmardqn0piiftk5c.apps.googleusercontent.com';
$redirectUri = 'http://mcc-dnc.dev/google-api/callback.php';
$scope = 'https://www.googleapis.com/auth/gmail.readonly';

$authUrl = 'https://accounts.google.com/o/oauth2/v2/auth?' . http_build_query([
    'client_id' => $clientID,
    'redirect_uri' => $redirectUri,
    'response_type' => 'code',
    'scope' => $scope,
    'access_type' => 'offline',
    'prompt' => 'consent'
]);

echo "<a href='$authUrl'>Connect with Gmail</a>";
