How to Authenticate with our API
In order to make requests, you will first need to get a token that validates your identity. You get a token by authenticating with your user credentials.
AVII API uses a JWT token authentication mechanism. Once you create a token, you need to include it as a header with every GraphQL request.
The authorization header has the following format:
Creating a JWT token
To create a new JWT token for a user, use the tokenCreate
mutation and provide the user’s credentials as the mutation input (email
and password
):
A successful response would look like:
Note
Save your token
To use the token and authorize subsequent requests, you need to include it as a HTTP Authorization request header:
Using JWT tokens in Playground
If you are using Playground to browse the API, you can authorize your requests by providing the JWT token in the HTTP HEADERS tab. To do that, paste the following JSON structure to the tab:
Using JWT tokens with cURL
To authenticate requests sent with cURL, use the -H
or --header
parameter to pass the JWT token:
Verifying and refreshing a token
To verify the token, use the following mutation:
A successful response:
To refresh the token:
A successful response: