-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
53 lines (42 loc) · 1.48 KB
/
Copy pathindex.php
File metadata and controls
53 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
require_once __DIR__ . '/vendor/autoload.php';
session_start();
$url = "https://sibeux.my.id/cloud-music-player/database/mobile-music-player/api/gdrive_api";
$goauthResponse = @file_get_contents($url);
$allApiData = ($goauthResponse) ? json_decode($goauthResponse, true) : [];
$clientId = null;
$clientSecret = null;
// Lakukan perulangan pada data yang diberikan
foreach ($allApiData as $item) {
if (!isset($item['email']))
continue;
if ($item['email'] === 'wahabinasrul_googleoauth_client_id') {
$clientId = $item['gdrive_api'];
} else if ($item['email'] === 'wahabinasrul_googleoauth_client_secret') {
$clientSecret = $item['gdrive_api'];
}
}
$client = new Google_Client();
$client->setClientId($clientId);
$client->setClientSecret($clientSecret);
$client->setRedirectUri('https://sibeux.my.id/cloud-music-player/api/oauth2callback.php');
$client->addScope("https://www.googleapis.com/auth/drive.readonly");
// Menambahkan parameter lain seperti access_type offline
$client->setAccessType('offline');
$client->setIncludeGrantedScopes(true);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login dengan Google</title>
</head>
<body>
<h2>Verifikasi Google OAuth</h2>
<p>Silakan login dengan akun Google Anda.</p>
<a href="<?php echo $client->createAuthUrl(); ?>">
<button>Login dengan Google</button>
</a>
</body>
</html>