Skip to content
Sign in

Authentication

This content is for 5.0 (Preview). Switch to 4.5 (Current) for the current release documentation.

All requests to our back-end services must include an access_token in the request header.

Terminal window
curl --location -g --request GET 'http://qapi.qpos.me/cubejs-api/v1/load?query={QUERY}' \
--header 'Authorization: Bearer {access_token}'
var axios = require("axios");
var config = {
method: "get",
url: "http://qapi.qpos.me/cubejs-api/v1/load?query={QUERY}",
headers: {
Authorization: "Bearer {access_token}",
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Terminal window
https://capi.qpos.me/login
Field Description
email Email address
password Secret password
Terminal window
curl --request POST 'https://capi.qpos.me/login' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'email=user@mail.com' \
--data-urlencode 'password=secret_password'
{
"access_token": "eyJhbGciOiJSU...",
"refresh_token": "AFxQ4_pd...",
"expires_in": 3600
}

Exchange a refresh token for an access token

Section titled “Exchange a refresh token for an access token”
Terminal window
https://capi.qpos.me/refresh

When an access token has expired or is close to expiring, a request can be made to exchange to refresh token for new access token. If the refresh token is no longer valid or has been revoked, the user must log in again to obtain a new access token and refresh token.

Field Description
refresh_token Refresh token obtained when signing in
Terminal window
curl --request POST 'https://capi.qpos.me/refresh' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'refresh_token=AFxQ4_r8BapvEWi81RJ...'
{
"access_token": "eyJhbGciOiJSU...",
"refresh_token": "AFxQ4_pd...",
"expires_in": 3600
}