forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
box.html
54 lines (37 loc) · 1.16 KB
/
box.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<link rel="stylesheet" href="/adorn/adorn.css"/>
<script src="/adorn/adorn.js" async></script>
<script src="client_ids.js"></script>
<link rel="stylesheet" href="./helper/alert.css"/>
<title>hello( box )</title>
<h1>hello( box )</h1>
<blockquote>
Box.com only provides authentication from apps which are using HTTPS. <a href="https://developers.box.com/docs/#api-basics">See Box.com API documentation</a>
</blockquote>
<script src="./helper/alert-https.js"></script>
<button onclick="login();" id="profile">Login Box</button>
<script src="../src/hello.js" class="pre"></script>
<script src="../src/modules/box.js" class="pre"></script>
<script class="pre">
var profile = document.getElementById( 'profile' );
function login(){
var box = hello('box');
box
.login()
.then(function(){
return box.api('me')
})
.then(function(r){
profile.innerHTML = "<img src='"+ r.thumbnail + "' width=24/>Connected to Box.com as " + r.name;
}, console.error.bind(console) );
}
</script>
<p>Initiate box client</p>
<script class="pre">
hello.init({
box : 'rdyb5se2fcuioryle3qdw2wcrps959x4'
},{
redirect_uri:'../redirect.html',
response_type:'code'
});
</script>