Authorization
API Key Authorization
One way to authorize your reqeusts is to use API keys. You can create an API key if you are already logged into the EVEDEX Exchange:
Click on your avatar in the upper right corner
Go to Settings → API → Create API Key
Once you have created an API key, you must include it in all private API requests by adding it to the x-api-key
header:
x-api-key: your_api_key
JWT Token Authorization
Another approach to authorization is JWT Token usage. To submit orders to the exchange, the client must complete an authorization procedure (according to the EIP-4361: Sign-In with Ethereum protocol), which includes the following steps:
Get a nonce using the GET /auth/nonce method.
Generate the data for the authorization signature.
Sign the data using the user's crypto wallet.
Send the signed data to the POST /auth/user/sign-up method and receive a JWT (
token
field in the response)
Important: Any request to the exchange REST API that requires an authorization JWT (accessToken
) must include the header Authorization: Bearer {accessToken}
(without the { }
).
Since the accessToken
JWT is valid for only a few minutes, it should be refreshed periodically. To do this:
When receiving a 401 code from any method that requires authorization, call the POST /auth/refresh method with the
Authorization
header set toBearer {refreshToken}
(without the{ }
)If the
refreshToken
is active, the response will return a new JWT, which should be used in place of the oldaccessToken
andrefreshToken
If the
refreshToken
is inactive and the method returns a 401 code, the user authorization procedure described above must be repeated
Last updated