Authentication is required to Create, Update and Delete objects from the Plattar API. This Guide will walk through on how to Authenticate with the Plattar API SDK.

Plattar uses encrypted user tokens for authentication. These tokens can be generated by users in the Plattar CMS and they provide user access to create, update and delete objects from the Plattar API.

Warning regarding Tokens

Never share your tokens and make sure to keep your tokens secret. Anyone with access to your token can use it to create, update or delete content in Plattar on your behalf. If you think your token has been compromised, login to the Plattar CMS and delete it.

Never use tokens for client-side code!

Tokens for Read operations

Tokens are not required for READ/GET operations in the Plattar API.

Tokens are not required for client-side code.

Authenticate using token
const {
} = require('@plattar/plattar-api');

// access your token though the environment variables (NodeJS)

There is also the option of verifying the validity of the token. For this a request must be made to the Plattar server. This step is optional.

Authenticate using token and optionally verify
const {
} = require('@plattar/plattar-api');

// optionally validate the token
Server.default().auth(process.env.PLATTAR_AUTH_TOKEN, { validate: true })
  .then((server) => {
  	// validation successful, progress with the application
  .catch((error) => {
  	// validation failed