get-openid-configuration
v1.0.1
Published
Simple node package to get the /.well-known/openid-configuration of your OpenID Connect provider.
Downloads
849
Readme
get-openid-configuration
This module makes an OpenID Provider Configuration Request to your OpenId provider and parses the response to an object. This may be useful for OAuth2 / OpenId Connect clients that need to know certain configurations of its provider. For a possible list of configurations see the OpenID Provider Configuration Response spec.
Usage Example
const loadConfig = require('get-openid-configuration');
loadConfig('https://accounts.google.com').then(config => {
console.log(`Google OpenID authorization_endpoint: ${config.authorization_endpoint}`);
console.log(`Google OpenID token_endpoint: ${config.token_endpoint}`);
console.log(`Google OpenID userinfo_endpoint: ${config.userinfo_endpoint}`);
console.log(`Google OpenID jwks_uri: ${config.jwks_uri}`);
console.log(`Google OpenID token_endpoint_auth_methods_supported: ${config.token_endpoint_auth_methods_supported}`);
}).catch((err) => {
console.error(err);
});
const loadConfig = require('get-openid-configuration');
(async () => {
try {
const config = await loadConfig('https://login.yahoo.com');
console.log(`Yahoo OpenID authorization_endpoint: ${config.authorization_endpoint}`);
console.log(`Yahoo OpenID token_endpoint: ${config.token_endpoint}`);
console.log(`Yahoo OpenID userinfo_endpoint: ${config.userinfo_endpoint}`);
console.log(`Yahoo OpenID jwks_uri: ${config.jwks_uri}`);
console.log(`Yahoo OpenID token_endpoint_auth_methods_supported: ${config.token_endpoint_auth_methods_supported}`);
} catch (err) {
console.error(err);
}
})();