-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
30 lines (26 loc) · 938 Bytes
/
index.html
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
<!doctype html>
<html>
<head>
<title>GitHub Authentication Example</title>
<!-- Make sure to include Nelify's authentiation library -->
<!-- Also available via npm as netlify-auth-providers -->
<script src="https://unpkg.com/netlify-auth-providers"></script>
</head>
<body>
<h1>GitHub Auth Demo:</h1>
<p><a href="#" id="login">Authenticate</a></p>
<p id="output"></p>
<script>
const anchorTag = document.getElementById('login')
const outputText = document.getElementById('output')
anchorTag.addEventListener('click', (e) => {
e.preventDefault()
const authenticator = new netlify.default ({})
authenticator.authenticate({provider:"github", scope: "user"}, (err, data) => {
err ? outputText.innerText = "Error Authenticating with GitHub: " + err :
outputText.innerText = "Authenticated with GitHub. Access Token: " + data.token
})
})
</script>
</body>
</html>