@sgftech/passport-saasform

0.0.22 • Public • Published

passport-saasform

Passport strategy for authenticating via external server.

Tested on Node.js and serverless applications, Firebase Functions, AWS Lambda.

With Saasform you can separate user authentication and management from your core application. All user flows like registration, login, password reset, inviting other users to an account, etc. are handled by Saasform. When a user is signed in, Saasform issues a JWT token and redirects the user to your application. This Passport strategy helps you validate Saasform's token with ease.

Install

npm install passport-saasform

or

yarn add passport-saasform

Usage

Here's a minimal working example:

const express = require('express');
const app = express();

const passport = require('passport');
const SaasformStrategy = require('passport-saasform');

passport.use(new SaasformStrategy({
  // saasformUrl: 'https://beautifulsaas.com',
  // appBaseUrl: 'https://app.beautifulsaas.com',
}));

const auth = passport.authenticate('saasform', { session: false });

app.get('/', auth, (req, res) => {
  res.send(`Hello ${req.user.email}!`);
});

const port = 3000;
app.listen(port, () => {
  console.log(`Ready: http://localhost:${port}/`);
});

Contribute

We welcome any type of contribution: code, bugs, feature requests... Oh, and tests!

Package Sidebar

Install

npm i @sgftech/passport-saasform

Homepage

saasform.dev

Weekly Downloads

2

Version

0.0.22

License

Apache-2.0

Unpacked Size

9.08 kB

Total Files

7

Last publish

Collaborators

  • sgfgov