Skip to main content

Authentication

Endpoint / Playground

Use any api client, or use your browser to access our graphql playground. https://iot.dimensionfour.io/graph

Create Account

First thing you need to do is create, verify and log in to your account.
You can do this either through the sign up feature on https://dimensionfour.io or through our GraphQL playground:

mutation CREATE_ACCOUNT {
account {
register(
input: {
firstname: "admin"
lastname: "admin"
email: "admin@company.com"
password: "admin"
}
) {
activationLink
}
}
}

Verify Account

You should receive an email with verification code. Use this code in following mutation:

mutation VERIFY_ACCOUNT {
account {
verifyAccount(input: { email: "admin@company.com", pincode: "123456" }) {
success
}
}
}

Log in

The response from this mutation will include a session cookie. If you are using a playground in your browser, this will be stored and used for future requests. You can also extract it and use it the same way using any api client.

mutation LOG_IN {
account {
login(
input: {
service: PASSWORD
params: { email: "admin@company.com", password: "admin" }
}
) {
id
}
}
}

Create tenant

mutation CREATE_TENANT {
tenant {
create(input: { name: "Company Name", planPriceId: BASIC_FREE }) {
id
}
}
}

Authorization

Account login

When you are logged in on playground, the queries will be performed with you as user, and all your authorizations. You need to add tenant-id to the headers to choose which tenant the query applies for.

// Headers:
{ "x-tenant-id": "tenant-id" }

Token

You can also create a token with the approprate scopes, and add that to the header. You can give these credentials to anyone to provide access to the tenant. Add scopes and name appropriately. You cannot retrieve the token later, but you can delete them.

// Headers:
{ "x-tenant-id": "tenant-id", "x-tenant-key": "<token>" }

Create token

mutation CREATE_ACCESS_TOKEN {
accessToken {
create(
input: {
name: "Admin Token"
scopes: [
CREATE_SPACE
READ_SPACE
UPDATE_SPACE
DELETE_SPACE
CREATE_POINT
READ_POINT
UPDATE_POINT
DELETE_POINT
CREATE_SIGNAL
READ_SIGNAL
DELETE_SIGNAL
CREATE_POINT_COMMAND
]
}
) {
id
token
}
}
}
# Headers:
# { "x-tenant-id": "<tenant-id>" }