express-userinfo

0.0.5 • Public • Published

Purpose

Use this express middleware to retrieve information about the user, when an OAuth2 access token is given.

The userinfo would typically adhere to OIDC's userinfo.

How

(Note: You need promises and ES6 support for const keyword; if this is an issue, it should be easy enough to downgrade; pull requests welcome.)

Assuming an existing expressjs application, install this middleware

npm install express-userinfo isomorphic-fetch

, then configure and use it in a route, e.g.

const expressUserinfo = require('express-userinfo')

const getUserinfo = expressUserinfo({
  site: 'http://my-oidc-provider.com'
})
app.get('/something-with-userinfo', getUserinfo, (req, res, next) => {
  res.send(`sub=${ req.userinfo.sub }, token=${ req.access_token }`)
})

Readme

Keywords

none

Package Sidebar

Install

npm i express-userinfo

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

3.16 kB

Total Files

3

Last publish

Collaborators

  • chris927