Authentication
The GraphQL API is authenticated with a secure cookie.
Creating a User
Creating a user happens with an HTTP POST request to the /users/login
path. The request must include a Content-Type: application/json
header. The JSON payload looks like this:
{
"username": "some-username",
"password": "some-password"
}
This request returns a cookie that is used to authenticate all other requests.
Authenticating Requests
Obtaining the cookie from the username/password combination happens in the same fashion as when creating a user. Just repeat the request used for creating a user. In order to authenticate GraphQL requests, include the returned cookie in the request. For example:
curl -H 'content-type: application/json' -b 'user=QgMwwh9+Q52CCuS0a6HAVr5BPSBY9nkgpRv5xU1DPYW1uhB1g2bd;' -d '{"query": "{trpd { vasps { name }}}"}' 'https://testing.21analytics.xyz/graphql'