|Cookies and Network Link||Camden_Daily||7/12/05 2:10 PM|
We would like to have a network link that requires a login, but we don't want to use .htaccess. What we would like to do is have a network link that points to a dynamically generated kml file. When the kml file is run on our server, it checks for a cookie to see if the user is logged in. If the user is logged in, it will show the data. However, if they aren't logged in, we would like to show a message which would have a link to our login page. Once logged in, they could refresh the network link, it would find the cookies, and display the data.
This doesn't currently work. I assume it's because Google Earth is a seperate beast from the built-in browser, and any cookies set in one aren't accessible by the other. Could anyone confirm this, or have any suggestions on how to require a login for the network link?
|Re: Cookies and Network Link||ink_polaroid||7/12/05 5:27 PM|
GE won't send/read cookies, but here's an easy solution:
User goes to your website, fills out form, clicks button, and gets a unique network link that points to a perl/php/asp/etc script on your server. When the link is active, your script parses the ?USER=foo ID that was generated and appended to the url for the netlink, and checks that they are still valid, either by reading a text file that was written at sign-up, or by querying a database.
|Re: Cookies and Network Link||oneiros||7/14/05 12:38 AM|
^ This is exactly how we're doing it.
The user logs into our website (either using their default web browser, or GE's internal plugin) which is authenticated using the traditional cookie mechanism. They can then download a KML file which sets up a Network Link, the URL of which includes a 'token' parameter.
This token contains a user ID and a timestamp (encoded, but not encrypted), plus some data created by hashing the details with a secret text string. It cannot be spoofed because no one knows the additional text, but we can fully authenticate both the User and how long it is since they logged in. Sorted.