forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.html
More file actions
43 lines (33 loc) · 1.02 KB
/
github.html
File metadata and controls
43 lines (33 loc) · 1.02 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
<!DOCTYPE html>
<link rel="stylesheet" href="/adorn/adorn.css"/>
<script src="/adorn/adorn.js" async></script>
<script src="client_ids.js"></script>
<script src="../src/hello.js"></script>
<script src="../src/modules/github.js"></script>
<title>hello( github )</title>
<h1>hello( github )</h1>
<button id='github' onclick="login('github');">github</button>
<pre id="result">Signin to get a list of repos</pre>
<script class="pre">
function login(network){
var github = hello(network);
github.login( function(){
// get user profile data
github.api( '/me', function(p){
document.getElementById( network ).innerHTML = "<img src='"+ p.thumbnail + "' width=24/>Connected to "+ network +" as " + p.name;
});
// Get a bespoke endpoint from github
github.api( '/user/repos', function(r){
document.getElementById('result').innerHTML = JSON.stringify(r,null,2);
});
});
}
</script>
<script class="pre">
hello.init({
github : GITHUB_CLIENT_ID
},{
redirect_uri : '../redirect.html',
oauth_proxy : OAUTH_PROXY_URL
});
</script>