How do I use JWTs?

JSON Web Tokens are what Doshii uses for POS authentication. Most languages have a library capable of generating JWTs. We use the hash algorithm HS256.

Here's an example in C#

// Using https://github.com/jwt-dotnet/jwt

var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var now = Math.Round((DateTime.UtcNow - unixEpoch).TotalSeconds);

var payload = new Dictionary<string, object>() {
  { "locationId", "119" },
  { "timestamp", now }
};

var vendorKey = "";
string token = JWT.JsonWebToken.Encode(payload, vendorKey, JWT.JwtHashAlgorithm.HS256);

Once you've generated your new, shiny JWT, you can now pass it up in the Authorization header as Bearer (mind the space).