API graphql test with mongodb, and JWT auth.
configure a kb8 machine with mongo.
To authenticate you need firt use the <base_uri>/api/register (POST), with the body below:
{
"username": "<your user name>",
"password": "<your password>"
}
The response (OK) must be:
{
"message": "registration success"
}
After that you must have a token to access anothers paths, to get a token valid for 1 hour use: <base_uri>/api/login (GET), with the body below:
{
"username": "<your user name>",
"password": "<your password>"
}
The response (OK) must be:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRob3JpemVkIjp0cnVlLCJleHAiOjE2NzQ2NjA5MjYsInVzZXJfaWQiOiI2M2QxMzE1ZTAwMmRlOTQ0ODA4YjJjZWMifQ.x9YqKrjR6fslVXaHbq7V8CLV37p5Sp07unVVmDxUvEk"
}
This token can be used like a querystring ?token= or in Header Authorization: bearer