2016-09-06 14:07:11 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title></title>
|
|
|
|
<script src="//js.live.net/v5.0/wl.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script>
|
|
|
|
// Extract authentication info from redirect URL in popup window
|
|
|
|
function getAuthInfoFromUrl()
|
|
|
|
{
|
|
|
|
if (window.location.hash != null)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
var result = new Object();
|
|
|
|
var authResponse = window.location.hash.substring(1);
|
|
|
|
var params = authResponse.split('&');
|
|
|
|
|
|
|
|
for (var i = 0; i < params.length; i++)
|
|
|
|
{
|
|
|
|
idx = params[i].indexOf('=');
|
|
|
|
|
|
|
|
if (idx > 0)
|
|
|
|
{
|
|
|
|
result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
// ignores parsing errors
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
2017-02-28 15:40:36 +00:00
|
|
|
// Main
|
|
|
|
if (window.opener != null && window.opener.onOneDriveCallback != null)
|
2016-09-06 14:07:11 +00:00
|
|
|
{
|
2017-02-28 15:40:36 +00:00
|
|
|
try
|
2016-09-06 14:07:11 +00:00
|
|
|
{
|
2017-02-28 15:40:36 +00:00
|
|
|
var authInfo = getAuthInfoFromUrl();
|
|
|
|
var token = authInfo['access_token'];
|
|
|
|
window.opener.onOneDriveCallback(token, window);
|
2016-09-06 14:07:11 +00:00
|
|
|
}
|
2017-02-28 15:40:36 +00:00
|
|
|
catch (e)
|
2016-09-06 14:07:11 +00:00
|
|
|
{
|
2017-02-28 15:40:36 +00:00
|
|
|
alert('OneDrive: ' + e.toString());
|
|
|
|
window.close();
|
2016-09-06 14:07:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|