Docs
Quickly setup a leaderboard for any game regardless of what language was used to write your game.
We do this by creating a unique secret token for each leaderboard that allows your game to easily authenticate when uploading scores to your leaderboard.
You should use this if
- ✅ You want a leaderboard for your game with
minimal setup. - ✅ You want a platform agnostic leaderboard
- ✅ You want a hosted leaderboard that's publicly accessible
- ✅ You enjoy trying out new product and providing useful feedback
- ✅ You need to display thousands of user scores
Quick Start
Step 1: Create an account
Step 2: Create a leaderboard via your profile
Step 3: Grab the token that was created with your leaderboard
Step 4: Send user scores to https://leaderboards.dev/score
curl -H 'x-access-token: ExampleTokenEy2YNW9nWVjEfpDC-t_SaBPSbJVEJRJA' \
https://leaderboards.dev/score \
--request POST \
-d '{"score": "42", "player_username": "user1"}'
// Creating a XHR object
let xhr = new XMLHttpRequest();
// open a connection
xhr.open("POST", "https://leaderboards.dev/score", true);
// Set the request header i.e. which type of content you are sending
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader('Authorization', 'Bearer ' + 'ExampleTokenEy2YNW9nWVjEfpDC-t_SaBPSbJVEJRJA');
// Create a state change callback
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
// Print received data from server
result.innerHTML = this.responseText;
}
};
// Converting JSON data to string
var data = JSON.stringify({ "score": "42", "player_username": "user1" });
// Sending data with the request
xhr.send(data);
#!/usr/bin/env python3
import requests
requests.post(
'https://leaderboards.dev/score',
headers={'x-access-token': 'ExampleTokenEy2YNW9nWVjEfpDC-t_SaBPSbJVEJRJA'},
json={'score': '42', 'player_username': 'user1'}
)
std::future invoke() {
return std::async(std::launch::async,
[](std::string const& url, std::string const& body) mutable {
std::string url = "https://leaderboards.dev/score";
std::string body = "{ \"score\": \"42\", \"player_username\": \"user1\" }";
std::list header;
header.push_back("Content-Type: application/json");
header.push_back("x-access-token: ExampleTokenEy2YNW9nWVjEfpDC-t_SaBPSbJVEJRJA");
curlpp::Cleanup clean;
curlpp::Easy r;
r.setOpt(new curlpp::options::Url(url));
r.setOpt(new curlpp::options::HttpHeader(header));
r.setOpt(new curlpp::options::PostFields(body));
r.setOpt(new curlpp::options::PostFieldSize(body.length()));
std::ostringstream response;
r.setOpt(new curlpp::options::WriteStream(&response));
r.perform();
return std::string(response.str());
}, url, body);
}
using System.Net.Http;
using (var client = new HttpClient())
{
var values = new Dictionary
{
{ "score", "42" },
{ "player_username", "user1" }
};
string json = JsonConvert.SerializeObject(values);
client.DefaultRequestHeaders.Add("x-access-token", "ExampleTokenEy2YNW9nWVjEfpDC-t_SaBPSbJVEJRJA");
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var builder = new UriBuilder(new Uri("https://leaderboards.dev/score"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, builder.Uri);
request.Content = new StringContent(myContent, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.SendAsync(request);
}
Coming soon...
Limitations
Do not use this if
- ❌ You need a highly secure way of storing scores