Skip to main content

Express PassportJS | Cryptr Configuration

⏲ ETA: 60 min | Cryptr PassportJS is your Resource server best implementation experience for your Express app.

This tutorial will show you how to implement Cryptr into an Express app using PassportJS.

First, to make our PassportJS SDK aware of your configuration, we chose to use an environment file.

You haven't a Cryptr Account

Don't worry we will assist you in configuring your first application

Create my cryptr Account with my first app

1. How to setup with an existing Cryptr account

  1. Go to your Cryptr Saas app to setup a new authorized application.
  2. From the left sidebar, click on the + button shown when you hover the API item.
  • new API 💡 You can create a new API in your Cryptr Sandbox Environment
  1. On the displayed popup, fill as follow
  • name -> The name of your api (ex: 'My new Angular App')
  • description -> A description for this api
  • technology name -> Node Express
  • Allowed web origins -> Your client application domain url (ex: https:///mydomain.com or http://localhost:4200)
    • ℹ We use this parameter to handle your CORS protection. Learn more about CORS
  • Allowed redirect uris -> The list of URIs where you want to redirect a user after an authentication. About redirect URIs
  1. After saving you'll get your config file.
  2. Store in .env file
multiple Angular Configuration

You could add two config files at root of your app like .env (.env.develop, .env.staging ...)

2. Configuration structure

.env
CRYPTR_AUDIENCES=YOUR_CLIENT_APPS_URIS
CRYPTR_ISSUER=YOUR_CRYPTR_ISSUER_URL
CRYPTR_CLIENT_ID=YOUR_API_CLIENT_ID
CRYPTR_TENANTS=YOUR_TENANTS_DOMAINS

REQUIRED PARAMETERS

CRYPTR_AUDIENCES* STRING

Comma separated string URIs array of your different client applications that will consume this API ex: http://localhost:4200,https://your-angular-domain.com

CRYPTR_ISSUER* STRING

Cryptr Issuer URL to reach for Requests validation. Something like https://auth.cryptr.co/t/my-domain

CRYPTR_CLIENT_ID* STRING

The ID reference of your api registered on Cryptr.

CRYPTR_TENANTS* STRING

Comma separated string URIs array of your managed tenants.

  • If you manage only one just put yours like my-domain
  • If your are a company that mange multiple entites put something like entity-1,my-company,another-entity