@edirect/oidc-client
v3.2.4
Published
OpenId Connect Client
Downloads
168
Maintainers
Keywords
Readme
@edirect/oidc-client
The EDirectInsure OpenId Connect Client.
Installation
$ npm i --save @edirect/oidc-client
Usage
(async () => {
const OidcClient = require('@edirect/oidc-client');
const oidcClient = await OidcClient({
grantType: 'GRANT_TYPE',
baseUrl: 'OIDC_PROVIDER_URL',
oidcPath: 'OIDC_PROVIDER_PATH',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectUri: 'YOUR_CALLBACK_URL'
});
const loginData = {
username: 'USERNAME',
password: 'PASSWORD',
}; // only necessary to password grant type
const accessTokenSet = await oidcClient
.getAccessToken(loginData || undefined);
console.log('\n', { accessTokenSet }, '\n');
// not applicable to client_credentials grant type
const refreshTokenSet = await oidcClient
.getRefreshToken(accessTokenSet);
console.log('\n', { refreshTokenSet }, '\n');
})()