This package has been deprecated

Author message:

This version of Reshuffle is being replaced with our new scripting platform for business workflows & integration. Thanks!

@reshuffle/passport
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@reshuffle/passport

"out-of-the-box" auth for your app.

Meant to be paired with @reshuffle/react-auth.

See a fully working demo here.

Installation

$ npm install @reshuffle/passport

Usage

Configure backend/_handler.js

const app = express();
app.use('/', authRouter());

// Custom routes go here

app.use(defaultHandler);

export default app;

Add custom routes

app.get('/display-name', (req, res) => {
  if (!req.user) {
    return res.sendStatus(403);
  }
  res.end(req.user.displayName);
});

Access user from your @exposed functions

backend/todos.js

import { getCurrentUser } from '@reshuffle/server-function';
import { get } from '@reshuffle/db';

/* @expose */
export async function getTodos() {
  const user = getCurrentUser(true /* required - will throw an error if not authenticated */);
  return get(`/todos/${user.id}`);
});

Package Sidebar

Install

npm i @reshuffle/passport

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

51.7 kB

Total Files

32

Last publish

Collaborators

  • avnerbraverman
  • spacebug
  • ashevat
  • lagache
  • duckranger