I try to use the datastore API with javascript. This is my Code:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta charset="UTF-8">
</head>
<body>
<script src="https://www.dropbox.com/static/api/dropbox-datastores-1.2-latest.js" type="text/javascript"></script>
<script>
var client = new Dropbox.Client({key: 'xxxxxxxxxxxx' });
// Try to finish OAuth authorization.
client.authenticate({interactive: false}, function (error) {
if (error) {
alert('Authentication error: ' + error);
}
});
alert(client.isAuthenticated());
if (client.isAuthenticated()) {
// Client is authenticated. Display UI.
}
</script>
</body>
</html>
The line alert(client.isAuthenticated()); always gives false which means that something went wrong with the authentication. Can someon tell me what I'm doing wrong?