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.
To test and run the example:
npm install
oryarn
npm start
oryarn start
- And then use
curl
orpostman
to hit any of the endpoints.
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.
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.