How to use the @authx/authx.StrategyCollection function in @authx/authx

To help you get started, we’ve selected a few @authx/authx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github the-control-group / authx / src / server.ts View on Github external
UEVIBMF0upDJMA53AFFx+0Fb/i76JFPTY7SxzvioIFeKRwY8evIRWQWYO95Os6gK
Bac/x5qiUn5fh2xM+wIDAQAB
-----END PUBLIC KEY-----`,
        ...(process.env.KEYPUBLIC2 ? [process.env.KEYPUBLIC2] : [])
      ],
      async sendMail(options: {
        to: string;
        subject: string;
        text: string;
        html: string;
        from?: string;
      }): Promise {
        console.log("--- SENDING EMAIL MESSAGE -------------------------");
        console.log(options);
      },
      strategies: new StrategyCollection([email, password, openid]),
      pg: {
        database: process.env.PGDATABASE ?? undefined,
        host: process.env.PGHOST ?? undefined,
        password: process.env.PGPASSWORD ?? undefined,
        port: process.env.PGPORT ? parseInt(process.env.PGPORT, 10) : undefined,
        ssl: process.env.PGSSL === "true" ? true : false,
        user: process.env.PGUSER ?? undefined
      }
    });

    // Apply the AuthX routes to the app.
    app.use(authx.routes());

    // Log errors - everything as JSON makes a happier you.
    app.on(
      "error",