I ended up using a PHP solution. Like a lot of PHP, it uses multiple
files - two besides the file with the login form.
MapFunctions.php is for invoking various map maintenance tools,
including login and requesting a Google token. It calls
GoogleLog1.php, which sets up the URL call Google requires for a token
request. GoogleLog1.php calls the Google Login where the token is
issued and then redirects to GoogleLog2.php which converts the single
use token into a session token and then returns the user to the
MapFunctions.php (or any other page of your choosing).
This is not elegant, but it didn't create dependencies on various
libraries I might lose track of over the years. The code follows:
MapFunctions.php
--------------------------
<?php
if (!isset($_SESSION)) {
session_start();
$token = $_SESSION['MM_token'];
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Google Map Functions</title>
<?php
function variousfunctions()
{
echo "This page is for invoking various map tools.";
echo "<br><br>";
}
?>
</head>
<body>
The Google Token is:
<?php
print $token;
print "<br><br>";
?>
<form name="form1" method="post" action="GoogleLog1.php">
Login to Google:
<label>login_google
<input type="submit" name="login_google" id="login_google"
value="Submit">
</label>
</form>
</p>
</body>
</html>
GoogleLog1.php
-----------------------
<?php
if (!isset($_SESSION)) {
session_start();
$token = $_SESSION['MM_token'];
}
?>
<?php
//Request a single-use authentication token from Google
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
$nextUrl = 'http://www.mysite----------------/GoogleLog2.php'; //
Change this to your site.
$scope = 'http://maps.google.com/maps/feeds/maps/';
$secure = 0; // set $secure=1 to request secure AuthSub tokens
$session = 1;
$authSubUrl = Zend_Gdata_AuthSub::getAuthSubTokenUri($nextUrl,
$scope, $secure, $session);
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Get a Google Token</title>
</head>
<body>
Fetching Token From Google
<script type="text/javascript">
var authurl = "<?= $authSubUrl ?>";
location.href = authurl;
</script>
</body>
</html>
GoogleLog1.php
-----------------------
<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php
$singleUseToken = $_GET['token']; // This is the single use
token
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
$sessionToken =
Zend_Gdata_AuthSub::getAuthSubSessionToken($singleUseToken); //Make
the token a session token, not just for one use.
$tokenInfo =
Zend_Gdata_AuthSub::getAuthSubTokenInfo($sessionToken); //Retrieve
information about the session token
$_SESSION['MM_token'] = $sessionToken; // Set a session variable so
the token is portable.
?>
<script>
location.href = 'MapFunctions.php'; //Return to where you started
</script>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.