Skip to content

Authentication

Most of the market API queries require the use of an authentication token, which you easily generate by just using the private key that identifies you as the owner of your universe. Just include it in the http headers.

Generating it is easy, you just need to sign the unix epoch time with your universe private key. The token will be valid for 5 minutes. Basically:

const signature = sign( keccak256(`FreeverseB2BTokenSalt${time}`) );
const token = `${time}:${signature}`
The http header should look like this:
headers: { Authorization: Freeverse 1641573766:k8Ju+3z7f+HHX5/j5Cd9zsttpjH07mzlLp0ke29zjt12Tn58fqYLSiLqUi4/LaDvSeaGIM87Xm7Z8RgOR6191xs= }

It is up to you to create such token with each request (the computational cost is negligible), or to refresh it when expired.

You can use our NPM package right away, have a look at the generate_auth_token.js example in our Examples source code.