@jioauth/express
v0.1.0
Published
[](https://www.npmjs.com/package/@jioauth/express)
Readme
JioAuth Express SDK
The JioAuth Express SDK written in TypeScript.
Docs site links will be added when JioAuth documentation is available.
Installation
Using npm
npm install @jioauth/expressUsing yarn
yarn add @jioauth/expressUsing pnpm
pnpm add @jioauth/expressUsage
Requires express-session. Default auth routes are under /jioauth/* (sign-in, sign-up, sign-in-callback, sign-out). Override with authRoutesPrefix.
import { handleAuthRoutes, withJioAuth } from '@jioauth/express';
import type { JioAuthExpressConfig } from '@jioauth/express';
const config: JioAuthExpressConfig = {
appId: '<app-id>',
appSecret: '<app-secret>',
endpoint: 'http://localhost:3001',
baseUrl: 'http://localhost:3000',
};
app.use(handleAuthRoutes(config));
app.get('/profile', withJioAuth(config), (req, res) => {
res.json(req.user);
});See @jioauth/express-sample in this repo for a full demo.
