Passport
Passport module wrapper built with passport
Installation#
Options#
| key | Description | Type | Default |
|---|---|---|---|
session | true to use session | boolean | false |
config/modules/all.ts
if we use a session we must load the express session middleware
config/middlewares/all.ts
Usage#
Now we define our passport strategies you can define as many strategies needed.
The validate method will be called the strategy arguments.
Now we define the user serializer
Finally, we define strategy auth and callback routes.
We use authenticate middleware with given strategy.
Once the user is authenticated we can use the req.isAuthenticated and req.user