Skip to content

Authentication

Koen edited this page Aug 9, 2017 · 4 revisions

Easy, it's a JWT-authentication!

Step 1: identify yourself

Do a POST to /authenticate/identify (OVER HTTPS) with the following body

{
   device_uuid: YOUR_UNIQUE_DEVICE_UUID
}

You'll receive an object with a token, the expected way of adding it to the header of your next calls, and an expiration date, like so:

{
   access_token: YOUR_TOKEN, //Don't worry, nobody can read it
   token_type: "bearer",
   expires: Int //The timestamp of expiration
}

Store the token, and check for the validity every time. Should your token expire, you'll receive this message:

{
   message: "Token has expired"
}

In this case, just identify yourself again with the call in step 1, and you're ready again!

Step 2: do your calls!

Now you can identify the device/app from where you're calling this with adding an authentication header, like so:

authentication: TOKEN_TYPE YOUR_TOKEN //Please replace it with your actual token, and the token-type provided 

If you do all of this right, everything works as expected, and every mutation you query will be fulfilled as this device!

Clone this wiki locally