Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/doodle-node-cli / src / prompts / decode-jwt-prompt.js
Size: Mime:
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;