@faable/auth-helpers-fastify
v1.0.6
Published
<p align="center"> <a href="https://faable.com"> <h1 align="center">Faable Auth Fastify Plugin</h1> </a> <p align="center">Faable Auth token verification plugin for Fastify</p> </p>
Downloads
21
Readme
Install
npm install @faable/auth-helpers-fastify
Usage
Register the plugin in your Fastify
instance.
import faableAuthPlugin from "@faable/auth-helpers-fastify";
...
// Register FaableAuth
fastify.register(faableAuthPlugin,{
domain:"https://<team>.auth.faable.com"
});
Then you can check access in an endpoint running faableAuth()
hook.
fastify.post("/", { preHandler: app.faableAuth() }, (req, res) => {
return res.send("Access Granted");
});
Options
| Plugin Options | Description | Default |
| -------------- | ------------------------------------------------------------ | ------- |
| domain
| Verify issuer of jwt token. Set your FaableAuth domain here. | '' |
| Verify Options | Description | Default |
| -------------- | ----------------------------------------------------------- | ------- |
| required
| User is required | true |
| scopes
| Check JWT scope claim has permissions defined in this array | [] |
Env vars
| Environment | Description |
| -------------------------- | -------------------------------------- |
| FAABLEAUTH_CLIENT_ID
| App Client ID |
| FAABLEAUTH_CLIENT_SECRET
| App Client Secret |
| FAABLEAUTH_DOMAIN
| Can be used instead of domain
option |