This example shows how to use GIS Cloud Authorization to access your private data.
The code:
// once the page is ready
giscloud.ready(function() {
// check token every second
setInterval(displayStatus, 1000);
// authorize with this app's client id, which is "ccb0db2768b14d7da0d6"
giscloud.oauth2.authorize("ccb0db2768b14d7da0d6", function() {
// create the sign in button
giscloud.oauth2.button("authButton");
});
});
...
// get token
var token = giscloud.oauth2.token();
...
// get maps - if there's a token available it will be used to
// access private data
giscloud.maps.list({ type: "private" })
.done(onMapsLoadingDone)
.fail(onMapsLoadingFailed);