passport-ibmsso-openidconnect
v1.0.1
Published
This module provides the passport strategy for authenticating with IBMid and w3id OpenID Connect.
Downloads
2
Maintainers
Readme
passport-ibmsso-openidconnect
This module provides the passport strategy for authenticating with IBMid and w3id OpenID Connect.
Install
$ npm install passport-ibmsso-openidconnect
Usage
Example
- Without discovery endpoint example:
import Strategy from 'passport-ibmsso-openidconnect';
import fs from 'fs';
const strategy = new Strategy({
authorizationURL: <Authorization Endpoint>,
tokenURL: <Token EndPoint>,
clientID: <Client ID>,
scope: 'openid',
response_type: 'code',
clientSecret: <Client Secret>,
callbackURL: <Redirect URI>,
skipUserProfile: true,
issuer: <Issuer>,
certs: [
fs.readFileSync(<Cert1 Path>),
fs.readFileSync(<Cert2 Path>),
...
]
}, (iss, sub, profile, accessToken, refreshToken, params, done) => {
process.nextTick(() => {
profile._json.accessToken = accessToken;
profile._json.refreshToken = refreshToken;
return done(null, profile);
});
});
strategy.init()
.then(() => {
passport.use('ibmopenidconnect', strategy.openid);
});
- With discovery endpoint example:
import Strategy from 'passport-ibmsso-openidconnect';
import fs from 'fs';
const strategy = new Strategy({
autoDiscovery: true,
clientID: <Client ID>,
scope: 'openid',
response_type: 'code',
clientSecret: <Client Secret>,
callbackURL: <Redirect URI>,
skipUserProfile: false,
issuer: <Issuer>
}, (iss, sub, profile, accessToken, refreshToken, params, done) => {
process.nextTick(() => {
profile._json.accessToken = accessToken;
profile._json.refreshToken = refreshToken;
return done(null, profile);
});
});
strategy.init()
.then(() => {
passport.use('ibmopenidconnect', strategy.openid);
});