Skip to main content

Node.JS

Setup

Clone the server

Start by cloning the server repository from GitHub. You can do this by running the following command:

git clone https://github.com/aserto-demo/todo-node-js-v2

Install dependencies

To install the application dependencies, run the following command:

yarn

Set up an .env file

Copy the .env.example file to .env and update the ASERTO_GRPC_CA_CERT_PATH to correspond to the path in which Topaz generated your certificates (by default this path will be $HOME/.local/share/topaz/certs/grpc-ca.crt, or $HOME\AppData\Local\topaz\certs on Windows). ASERTO_DIRECTORY_REJECT_UNAUTHORIZED=false will let you connect to a local directory without passing the certificate.

cp .env.example .env

Your .env file should look like:

JWKS_URI=https://citadel.demo.aserto.com/dex/keys
ISSUER=https://citadel.demo.aserto.com/dex
AUDIENCE=citadel-app

ASERTO_POLICY_ROOT=todoApp

ASERTO_AUTHORIZER_SERVICE_URL=localhost:8282
ASERTO_DIRECTORY_SERVICE_URL=localhost:9292
ASERTO_DIRECTORY_REJECT_UNAUTHORIZED=false

# On Windows, change this to $HOMEPATH\AppData\Local\topaz\certs\grpc-ca.crt
ASERTO_GRPC_CA_CERT_PATH=${HOME}/.local/share/topaz/certs/grpc-ca.crt

Start the server

yarn start

Next steps

Test your server by using the sample web Todo application.