The library provides OpenID Connect (OIDC) and OAuth2 protocol support for the console applications. The library is an extension for oidc-client to support console applications.
The logged in user is stored encrypted in the user profile directory with the encryption key stored by keytar keytar.
Node.js v4.4 or later required.
npm install oidc-client-console --save
The library can be used with any OIDC provider Auth0, Azure AD, Okta, Keyclock etc.
const oidcConsole = require('oidc-client-console');
(async function() {
const user = await oidcConsole.getUser({
authority: 'https://login.microsoftonline.com/<tenant>/v2.0',
client_id: '<clientId>',
response_type: 'code',
scope: 'openid profile email'
});
console.log(JSON.stringify(user));
})();
appSettings.appName = 'oidc-console-app'; //default
appSettings.port = 5000; //default
git clone https://github.com/AlexF4Dev/oidc-client-console.git
cd oidc-client-console
npm install
npm run build
create .env file in root folder (Azure example):
Create application in Azure with http://localhost:5000 callback url
AUTHORITY=https://login.microsoftonline.com/<tenant>/v2.0
CLIENT_ID=<clientId>
npm start