Skip to content

Instantly share code, notes, and snippets.

@wezm
Created December 13, 2010 02:49
Show Gist options
  • Select an option

  • Save wezm/738594 to your computer and use it in GitHub Desktop.

Select an option

Save wezm/738594 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>GData Session Acquirer</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the latest version of the Google Data JavaScript Client
google.load('gdata', '2.x');
function onGoogleDataLoad() {
// Put your code here
}
// Call function once the client has loaded
google.setOnLoadCallback(onGoogleDataLoad);
function login() {
var scopeElem = document.getElementById("scope");
var scopeOption = scopeElem.options[scopeElem.selectedIndex];
var token = google.accounts.user.login(scopeOption.value);
console.log(token);
return false;
}
function checkParams() {
var tokenElem = document.getElementById("token");
token.innerHTML = document.location.href;
}
</script>
</head>
<body onload="checkParams()">
<h1>GData Session Acquirer</h1>
<div id="token"></div>
<label for="scope">Scope</label>
<select id="scope">
<option value="https://spreadsheets.google.com/feeds/list">Lists API</option>
<option value="https://spreadsheets.google.com/feeds/worksheets">Worksheet</option>
</select>
<button onclick="return login()">Login</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment