-
Notifications
You must be signed in to change notification settings - Fork 5
/
guestissuer-login.js
36 lines (31 loc) · 1.13 KB
/
guestissuer-login.js
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
//
// Copyright (c) 2017 Cisco Systems
// Licensed under the MIT License
//
const debug = require('debug')('guest:login')
const program = require('commander')
program
.description('fetch a new access token for Webex API, SDKs and Widgets.\n\
note that:\n\
- the user identity is inferred from the specified "Guest" token\n\
- the returned access token is only valid for 6 hours')
.arguments('<guest-token>')
.action(function (guestToken) {
// Check issuer token is present
if (!guestToken) {
console.error('missing guest token, exiting...')
console.error("you can generate a guest token with command: 'guestissuer create'")
process.exit(1)
}
debug('successfully collected guest token')
// Request access token
const GuestUtil = require('./guestissuer-util')
GuestUtil.fetchToken(guestToken)
})
.on('--help', function () {
console.log('')
console.log(' Example:')
console.log('')
console.log(' $ guestissuer login "12tre33.54343275.5456456745"')
});
program.parse(process.argv)