Authentication and Authorization

This page will show you how to create API keys and authenticate in order to use your data.

Create API keys

In order to interact with your data, you need to authenticate using API keys. Head over to the Access Control tab and click API Keys to create API Keys. Copy the API key and the secret and store them somewhere safe. You will need to provide them while authenticating.

Create Policies

As a developer, you want to be able to specify the permissions of specific actions of applications on resources so that you can have full control on access to your application’s data. For this goal policies are introduced. To be able to use the policies feature, you need to have at least one dataset and one API key in the project. In order to create/update policy, you will need to specify the description, select at least one resource (currently policies are available only on a dataset level), select at least one subject (which is the api key) and pick the actions that this policy allows. After saving, this policy will automatically be applied to your project .

List policies

Head over to the Access Control tab and click Policies to view list of already created policies. All policy related actions can be performed on this page.

Create policy

Click the button "Create policy". The creation dialog will appear. Fill in all necessary data and hit "Save policy". A new policy is created and ready to use.

Update policy

Click the "pencil" button/icon on the policy row of your choice. The dialog for policy update will appear. Change all necessary data and hit "Save policy". The policy is updated.

Delete policy

Click the "trash" button/icon on the policy row of your choice. The "Delete Confirmation" dialog will appear. Read the message carefully and choose the action that suits your needs.

Authenticate through the Javascript SDK

In order to communicate with your data in your Javascript application, you can use the Javascript SDK. You can use the SDK both serverside and browserside. In order to use your data serverside, you need to have Nodejs installed. Authentication and authorization is handled automatically by the SDK, you only needs to provide your credentials once at SDK initialization.

You can install the SDK through NPM:

npm install jexia-sdk-js --save


The jexiaClient() function will return an instance of the Client class. On Node.JS, you will need to provide a fetch standard compliant function as a parameter. You will need to add a compatible dependency to your project. For development of the SDK we've used node-fetch

const sdk = require('jexia-sdk-js/node');
const fetch = require("node-fetch");
 
let initializedClientPromise = sdk.jexiaClient(fetch).init({appUrl: "your Jexia App URL", key: "<your-apikey>", secret: "<your-secret>"});
initializedClientPromise.then( (initializedClient) => {
  // you have been succesfully logged in!
  // you can start using the initializedClient variable here
}).catch( (error) => {
  // uh-oh, there was a problem logging in, check the error.message for more info
});

Authenticate through REST API

You can also authenticate though the REST API:

Make a POST request 

POST https://<project-id>.app.jexia.com/ak/authentication

Send the e-mail and password along with the request in the body:

{
    "key": "<your-apikey>",
    "secret": "<your-secret"
}

The response will look like this:

{
    "refresh_token": "<your-jexia-refresh-token>",
    "token": "<your-jexia-token>"
}

Now send your token along in the Authorization Header with each request you make

"Authorization" : "<your-jexia-token>"