Repository URL to install this package:
|
Version:
1.12.0 ▾
|
const inquirer = require('inquirer');
const jwtDecode = require('jwt-decode');
/**
* Log the user in and get a JWT Token from Keycloak
*
* @param {Object} options
* @param {Object} options.jwt
*/
async function decodeJwt(options = {}) {
await inquirer
.prompt([
{
type: 'input',
name: 'jwt',
default: options.jwt,
when: typeof options.jwt === 'undefined',
message: `Enter the JWT to decode`,
},
])
.then(answers => {
const { jwt } = {
...options,
...answers,
};
console.log(jwtDecode(jwt));
});
}
module.exports = decodeJwt;