-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathguestissuer
39 lines (33 loc) · 1.67 KB
/
guestissuer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env node
//
// Copyright (c) 2017 Cisco Systems
// Licensed under the MIT License
//
const debug = require('debug')('guest')
var program = require('commander')
program
.version('v0.6.2')
.description('Utility to create JWT "Guest" tokens and fetch access tokens for "Permanent Guests" of a Webex "Guest Issuer" organization\n\
note that the "quick" command is a shortcut to typing "create" then "login" commands')
.command('quick [-is] <user_id> <user_name>', 'returns a temporary access token for the specified "Guest" user and developer "Organization"', { isDefault: true })
.command('create [-is] <user_id> <user_name>', 'creates a reusable JWT "issuer" token for the specified user and organization')
.command('login <guest_token>', 'returns a temporary access token for the user associated to the "Guest token"')
.command('verify <token>', 'reveals info behind a Guest token, or an access token')
.on('--help', function () {
console.log('')
console.log(' Examples:')
console.log('')
console.log(' $ guestissuer quick 123456789 "John Doe" -i "issuer_id" -s "issuer_secret"')
console.log(' 4234324.45435435.543543543')
console.log('')
console.log(' or without the shortcut:')
console.log('')
console.log(' $ guestissuer create 123456789 "John Doe" -i "issuer_id" -s "issuer_secret"')
console.log(' 12tre33.54343275.5456456745')
console.log(' $ guestissuer login "12tre33.54343275.5456456745"')
console.log(' 4234324.45435435.543543543')
});
program.parse(process.argv);
if (!process.argv.slice(2).length) {
program.outputHelp();
}