/* * An usage example of the previous library */ function loadData() { // Send score 1 indiexpo.sendScore(1).then(function(data) { console.log('score sent, response:', data); }); // Get current user username indiexpo.getUserData().then(function(data) { console.log('user data, response:', data); }); // Gets the current score chart indiexpo.getScores().then(function(data) { console.log('current scores, response:', data); }); } var indiexpo = new IndiexpoClient('YOUR GAME KEY HERE'); // If the user is already logged in previously if (indiexpo.isAuthenticated()) { loadData(); } else { // Requesting user key. // If you're outside the indiexpo iframe, it asks for copy/paste the code from a popup window. // Otherwise, it uses an xhr request indiexpo.requestUserKey() .then(function(userKey) { // indiexpo.authenticate(userKey).then(function(data) { console.log('Correctly authenticated!'); loadData(); }); }); }