@reshuffle/passport

Passport strategy for reshuffle authentication

This version of Reshuffle is being replaced with our new scripting platform for business workflows & integration. Thanks!
Last updated a year ago by binaris .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @reshuffle/passport 
SYNC missed versions from official npm registry.

@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}`);
});

Current Tags

  • 0.2.0                                ...           latest (a year ago)
  • 0.2.0                                ...           next (a year ago)

9 Versions

  • 0.2.0 [deprecated]           ...           a year ago
  • 0.1.3 [deprecated]           ...           a year ago
  • 0.1.2 [deprecated]           ...           a year ago
  • 0.1.1 [deprecated]           ...           a year ago
  • 0.1.0 [deprecated]           ...           a year ago
  • 0.0.5 [deprecated]           ...           a year ago
  • 0.0.4 [deprecated]           ...           a year ago
  • 0.0.3 [deprecated]           ...           a year ago
  • 0.0.2 [deprecated]           ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |