{"repo":"fastify/fastify-auth","free":true,"listed":false,"github":"https://github.com/fastify/fastify-auth","clone":"git clone https://github.com/fastify/fastify-auth.git","description":"Run multiple auth functions in Fastify","language":"JavaScript","stars":380,"topics":["fastify","fastify-plugin","authentication","strategy-pattern"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"@fastify/auth This module does not provide an authentication strategy but offers a fast utility to handle authentication and multiple strategies in routes without adding overhead. See a complete example here. Install Compatibility Plugin version Fastify version --------------- ----------------- =5.x ^5.x =3.x =1.x <3.x ^3.x ^0.x ^2.x ^0.x ^1.x Please note that if a Fastify version is out of support, then so are the corresponding versions of this plugin in the table above. See Fastify's LTS policy for more details. Usage @fastify/auth does not provide an authentication strategy; authentication strategies must be provided using a decorator or another plugin. The following example provides a straightforward implementation to demonstrate the usage of this module: The default relationship of these customized authentication strategies is or , but and can also be used: For composite authentication, such as verifying user passwords and levels or meeting VIP criteria, use nested arrays. For example, the logic [(verifyUserPassword and verifyLevel) or (verifyVIP)] can be achieved with the following code: If the relation ( defaultRelation ) parameter is and , then the relation inside sub-arrays will be or . If the relation ( defaultRelation ) parameter is or , then the relation inside sub-arrays will be and . auth code resulting logical expression ------------- :-------------: fastify.auth([f1, f2, [f3, f4]], { relation: 'or' }) f1 OR f2 OR (f3 AND f4) fastify.auth([f1, f2, [f3, f4]], { ","default_branch":null,"files":null,"tree":[],"storefront":"/r/fastify","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/fastify/fastify-auth/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}