0.5.0 • Published 10 months ago
@yikesable/fastify-saas-auth-pg v0.5.0
Fastify SaaS Auth PG
Postgres support for Fastify SaaS Auth
Usage
import fastify from 'fastify';
import { fastifySaasAuthPlugin } from '@yikesable/fastify-saas-auth';
import { saasAuthPg } from '@yikesable/fastify-saas-auth-pg';
const app = fastify();
app
.register(import('@fastify/postgres'), { connectionString: DATABASE_URL })
.register(fastifySaasAuthPlugin, parent => {
/** @type {import('@yikesable/fastify-saas-auth').SaasAuthOptions} */
const config = {
authIssuers,
authPageHandler: async (request, reply) => {
// Render authentication page
},
baseUrl,
getUserIdFromHeader: NODE_ENV === 'test',
sessionSecurityKey: SESSION_SECRET,
...saasAuthPg(parent.pg),
};
return config;
});
API
TBD