-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyex.html
More file actions
59 lines (53 loc) · 2.62 KB
/
myex.html
File metadata and controls
59 lines (53 loc) · 2.62 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
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta name="google-site-verification" content="zGZ1eNvpLwHLpQ9mT9dOPaKHi90v6fx8J2ZsPlv15wM" />
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="login.css">
<title>Login met Google</title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="434251851653-2t5vuufp0tu4iv2omko3d8pt40podqrv.apps.googleusercontent.com">
</head>
<body>
<h1>Login met Google</h1>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Dit is de unieke ID van de gebruiker
console.log("Naam: " + profile.getName());
console.log("Afbeelding URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail()); // Dit is null als de gebruiker geen e-mailadres heeft gegeven aan Google
}
// Bijgewerkte code met de juiste Client ID en redirect URIs
function googleLogin() {
gapi.load('auth2', function() {
gapi.auth2.init({
client_id: '434251851653-2t5vuufp0tu4iv2omko3d8pt40podqrv.apps.googleusercontent.com',
redirect_uri: 'https://aminfaka.github.io/menu.html',
scope: 'email'
}).then(function() {
var googleAuth = gapi.auth2.getAuthInstance();
if (googleAuth.isSignedIn.get()) {
var profile = googleAuth.currentUser.get().getBasicProfile();
console.log("ID: " + profile.getId()); // Dit is de unieke ID van de gebruiker
console.log("Naam: " + profile.getName());
console.log("Afbeelding URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail()); // Dit is null als de gebruiker geen e-mailadres heeft gegeven aan Google
} else {
googleAuth.signIn().then(function() {
var profile = googleAuth.currentUser.get().getBasicProfile();
console.log("ID: " + profile.getId()); // Dit is de unieke ID van de gebruiker
console.log("Naam: " + profile.getName());
console.log("Afbeelding URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail()); // Dit is null als de gebruiker geen e-mailadres heeft gegeven aan Google
});
}
});
});
}
</script>
<button onclick="googleLogin()">Inloggen met Google</button>
<button onclick="window.location.href='https://aminfaka.github.io/menu.html'">Inloggen als gast</button>
</body>
</html>