Login
Login endpoint is required to obtain access to all Private๐ endpoints. The login process involves three steps which are stated below in brief:
Nonce creation: Generate a payload using the /auth/nonce endpoint.
Sign the payload: To sign the payload obtained after accessing the above API, use the NodeJS SDK
signMsg
helper function.Generate access token: After generating the signature, the signature & eth address is sent in the /auth/login endpoint.
Please visit tanX website and create an account using your wallet before proceeding with the below steps.
1. Nonce Creation
A nonce is a variable that is generated just once and can be used only one time. Generation of a nonce is the first step of the login process. The payload received in this step will be required in the next one.
Endpoint
Request Body
eth_address
STRING
YES
Example:
Response
2. Sign The Payload
In this step youโd be required to sign the โpayloadโ obtained through the first step i.e., โNonce Creationโ ๐. Use โpayloadโ as variable โdataโ and call the signMsg function ( have a look at the snippet below ) located in use the NodeJS SDK. to sign โdataโ with your private key. A signature that will be required in the third step will be returned at the end of this process.
Code snippet
3.Generate Access Token
The access token (JWT) is used to authenticate your request for private endpoints. This key allows tanX to ensure that the requests are always coming from the rightful owner. Make use of the signature that was returned in the previous step โSign The Payloadโ ๐, along with the ethereum address to receive a JWT Access Token.
Endpoint
Request Body
eth_address
STRING
YES
user_signature
STRING
YES
Example
Response
Refresh Token for Login
Endpoint
Request body
Response
Last updated
Was this helpful?