UNPKG

hellojs-xiaotian

Version:

A clientside Javascript library for standardizing requests to OAuth2 web services (and OAuth1 - with a shim)

48 lines (36 loc) 1.01 kB
<!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.polyfill.js"></script> <script src="../src/hello.js"></script> <script src="../src/modules/windows.js"></script> <title>hello( windows )</title> <h1>hello( windows )</h1> <button id='login' onclick="login('windows');">Windows</button> <div id="result"></div> <p>Build a login, call with login('windows')</p> <script class="pre"> function login(network){ var windows = hello(network); windows .login() .then(function(){ // Get Profile return windows.api('me'); }).then(function(p){ // Diplay document.getElementById('login').innerHTML = "<img src='"+ p.thumbnail + "' width=24/>Connected to "+ r.network+" as " + p.name; }); } </script> <p>Assign app client id</p> <script class="pre"> hello.init({ 'windows' : WINDOWS_CLIENT_ID }, { redirect_uri:'../redirect.html', oauth_proxy: OAUTH_PROXY_URL }); </script>