Authentication
Authentication is used on all our mutation operations, as well as select query operations. In the rest of the docs, operations that requires authentication will be noted.
Overview
We use JWT tokens as our authentication on our server. Our server will first generate a random nonce which needs to be signed using your TON wallet as a verification of ownership. Upon validation of your signed message, an access (and refresh) token will be issued.
Token Validity
Access tokens are valid for 30 minutes of issuance. After which, the token will be expired and any authenticated operations you perform will return HTTP 401 error. You have to use the refresh token to get another access token after 30 minutes. Refresh tokens are valid for 7 days before you have to perform this authentication process again. There is no limits on the usage of this refresh token.
There are 3 authentication resolvers:
generateNonce
getToken
refreshToken
generateNonce
This operation returns a nonce which needs to be signed using a TON Wallet. Each generated nonce is valid for 5 minutes. An unused nonce will be invalidated and a new nonce will need to be generated.
Query
Response
Parameters:
id
: Identifier for the generated noncenonce
: Message to be signedtimestamp
: Timestamp of nonce issuance
getToken
This operation takes in the signed message and id
from generateNonce
and returns the access token and refresh tokens if the signed message is validated.
⛔️ Access and refresh tokens are NOT shareable
Tokens issued can only be used to execute mutations for Profiles that are owned by the address
provided during the getToken
operation. Usage by any other Profiles will return 400 error.
Query
Request inputs:
id
: Identifier for the generated nonceaddress
: Ton Wallet addressIn raw format
For reference on address formats: https://docs.ton.org/learn/overviews/addresses#raw-and-user-friendly-addresses
signedMessage
: Signed nonce
Response
Parameters:
accessToken
refreshToken
refreshToken
This operation returns a new access token when provided a valid refresh token.
Query
Request inputs:
token
: refresh token
Response
Parameters:
token
: Newly issued access token
Error Responses
Last updated