Skip to content

Uber5/express-userinfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Express middleware to retrieve OIDC userinfo

Resources

Stars

Watchers

Forks

Packages

No packages published