Authentication
Your Console comes with a powerful, comprehensive RESTful API that you can access within your app. Generate gameplay URLs, retrieve scores, and more.
Generate a JWT Bearer Token
To authenticate requests to the 2bttns API, you'll need to generate a JWT Bearer token to use in your request header using the api/authentication/token endpoint. To do this, you'll use the app_id and secret in you Console under Settings/Apps.
Returns a JSON Web Token (JWT) you can use to authenticate API calls to 2bttns.
You can get the app_id and secret from your 2bttns admin console, under Settings/Apps.
Successful response
Error response
GET /api/authentication/token?app_id=text&secret=text HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
textTo test your token, pass it as the header using the api/authentication/checkAuthType endpoint:
Returns a message that tells you what type of authentication you used to call this endpoint, if you are authenticated.
Successful response
Error response
GET /api/authentication/checkAuthType HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
textTo successfully connect your app to the Console, pass the Bearer Token in your API requests.
OpenAPI and your Console 
You can try out the API within your Console by using your JWT token. Open your Console and navigate to API and click Authorize.

The 2bttns API within your console is an OpenAPI compliant REST API built using tRPC with Next.js. For a comprehensive overview of the available endpoints, open your Console and navigate to http://localhost:3262/api-documentation.
Last updated
Was this helpful?