@sgftech/passport-saasform
v0.0.22
Published
Saasform authentication strategy for Passport
Downloads
1
Maintainers
Readme
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!