Skip to content

memeinewa/passport-oneid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

Create Application

Before using passport-oneid, you must register an application with oneid. If you have not already done so, a new application can be created at OneID. Your application will be issued a clientId, clientSecret and refCode, which need to be provided to the strategy.

Configure Strategy

The OneID authentication strategy authenticates users using a OneID Account. The client id and secret obtained when creating an application are supplied as options when creating the strategy. receives the access token, as well as profile which contains the authenticated user's OneID profile.

passport.use(new OneIDStrategy({
    clientID: ONEID_APP_ID,
    clientSecret: ONEID_APP_SECRET,
    refCode: ONEID_APP_REFCODE
  }
));

Authenticate Requests

Use passport.authenticate(), specifying the 'oneid' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/oneid',
  passport.authenticate('oneid'));

app.get('/auth/oneid/callback',
  passport.authenticate('oneid', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published