// https://www.npmjs.com/package/openid-client
// https://github.com/panva/node-openid-client
const Issuer = require('openid-client').Issuer;
var client;
Issuer.discover('https://account.bioid.com/connect/.well-known/openid-configuration')
.then((bioIdIssuer) => {
console.log('Discovered bioIdIssuer %s', bioIdIssuer);
var client_id = 'CLIENT_ID';
var client_secret = 'CLIENT_SECRET'
client = new bioIdIssuer.Client({
client_id: client_id,
client_secret: client_secret
});
});
app.get('/api/v0/bioid/login', (req, res) => {
// after authenticating user will be redirected to /callback
var url = client.authorizationUrl({
redirect_uri: 'http://ti-acs-swarmagents.southcentralus.cloudapp.azure.com:8080/callback',
scope: 'openid',
});
res.redirect(url);
});
app.get('/callback', (req, res) => {
// req.query === .../callback?code=XXX
client.authorizationCallback('http://ti-acs-swarmagents.southcentralus.cloudapp.azure.com:8080/callback', req.query)
.then((tokenSet) => {
console.log('received and validated tokens %j', tokenSet);
console.log('validated id_token claims %j', tokenSet.claims);
// Here we return the token set for the BioId OpenId Connect User.
res.json({
tokenSet: tokenSet
});
});
});
Implement an express wrapper using: