universal-authentication implementation on top of universal-express-controllers
npm install @universal-packages/express-controllers-authentication
npm install @universal-packages/express-controllers
Initialize the authentication api and the authentication controller to prepare routing configuration before the ExpressControllers
runs. The authentication controller is loaded automatically by ExpressControllers
.
import { ExpressControllers } from '@universal-packages/express-controllers'
import { initialize } from '@universal-packages/express-controllers-authentication'
await initialize({ secret: 'my-secret' })
const app = new ExpressControllers({ port: 3000 })
await app.prepare()
await app.run()
Now all authentication actions are available to access on path authentication/<action>
initialize
takes the same options as Authentication
.
Additionally takes the following ones:
-
rootPath
String
default: /authentication
You can set the root of all authentication routes, ex:/auth/<action>
Enabled authentication modules that provide a controllers will be enabled in express controllers if they are enabled in the authentication api. For example the default module provided by universal-authentication
is enabled by default.
This library is developed in TypeScript and shipped fully typed.
The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.