1.0.6 • Published 9 months ago
@faable/auth-helpers-fastify v1.0.6
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 |