Skip to content

The Authress Starter Kit for Express. Includes Authentication, Authorization, user identity and role management

License

Notifications You must be signed in to change notification settings

Authress/express-starter-kit

Repository files navigation

Authress Starter Kit: Express + Typescript

The Express Starter Kit for Authress includes Authentication, Authorization, user identity and role management

This is an example built specifically for using Authress with Typescript & Express.

How to use this repository

To test and run the example:

  • npm install or yarn
  • npm start or yarn start
  • And then use curl or postman to hit any of the endpoints.

See the code

If you just want to see the code, it's available right here. Most of it is boilerplate to run the example the interesting part starts a bit lower down.

There are three controllers, they all use Authress in some way to authorize the request and check the users permissions:

  • Accounts - General creating an account and setting up SSO
  • ExampleResource - How to secure a reason creating access and updating it
  • Users - Managing users for the whole account.

Details

The middleware

The important part of the integration is to get the userId and Authress client to authorize the user. This is done by adding a middleware to parse out the caller, and one line in the service to validate this.