UNPKG

@pnp/cli-microsoft365

Version:

Manage Microsoft 365 and SharePoint Framework projects on any platform

33 lines 1.36 kB
import { z } from 'zod'; import { cli } from '../../../cli/cli.js'; import { globalOptionsZod } from '../../../Command.js'; import AnonymousCommand from '../../base/AnonymousCommand.js'; import commands from '../commands.js'; export const options = z.strictObject({ ...globalOptionsZod.shape, service: z.enum(['VivaEngage']).alias('s') }); class CliConsentCommand extends AnonymousCommand { get name() { return commands.CONSENT; } get description() { return 'Consents additional permissions for the Microsoft Entra application used by the CLI for Microsoft 365'; } get schema() { return options; } async commandAction(logger, args) { let scope = ''; if (args.options.service === 'VivaEngage') { scope = 'https://api.yammer.com/user_impersonation'; } await logger.log(`To consent permissions for executing ${args.options.service} commands, navigate in your web browser to https://login.microsoftonline.com/${cli.getTenant()}/oauth2/v2.0/authorize?client_id=${cli.getClientId()}&response_type=code&scope=${encodeURIComponent(scope)}`); } async action(logger, args) { await this.initAction(args, logger); await this.commandAction(logger, args); } } export default new CliConsentCommand(); //# sourceMappingURL=cli-consent.js.map