DinoChiesa / ApigeeEdge-API-Traffic-Summarizer

A nodejs command-line tool that produces a summary sheet of traffic for an Apigee Edge organization
Apache License 2.0
10 stars 7 forks source link

MFA Support #6

Open gkuhn1 opened 3 years ago

gkuhn1 commented 3 years ago

Is it possible to implement MFA support for these reports? Or is there any workaround I can do to manually set a token (other than disabling MFA)?

Currently with MFA enabled I get the following result:

Apigee Edge Analytics Summarizer tool, version: 20201116-1619
Node.js v10.14.1

[2020-Nov-17 09:03:52] using Edge Admin API endpoint: https://api.enterprise.apigee.com
[2020-Nov-17 09:03:52] using chart period: 202001-202012
[2020-Nov-17 09:03:52] connect: {"orgname":"<redacted>","loginBaseUrl":"https://login.apigee.com","user":"<redacted>","mgmtServer":"https://api.enterprise.apigee.com"}
[2020-Nov-17 09:03:52] found no stashed token.
[2020-Nov-17 09:03:52] POST https://login.apigee.com/oauth/token
[2020-Nov-17 09:03:52] status: 401
[2020-Nov-17 09:03:52] result: {"error":"unauthorized","error_description":"Error: Invalid MFA code."}
[2020-Nov-17 09:03:52] POST error: bad status: 401
[2020-Nov-17 09:03:52] Error: {}
DinoChiesa commented 3 years ago

Yes, you can specify the -C option on the command line to specify the passcode. Have you tried that? I don't think there's a way to manually specify a token, but you shouldn't have to.

$ node ./trafficByApiSummarizer.js 
Apigee Edge Analytics Summarizer tool, version: 20201116-1619
Node.js v12.14.1

[2020-Nov-17 21:22:18] You must specify an organization
Usage:
  node trafficByApiSummarizer.js [OPTION]

Options:
  -M, --mgmtserver=ARG the base path, including optional port, of the Edge mgmt server. Defaults to https://api.enterprise.apigee.com .
  -u, --username=ARG   org user with permissions to read Edge configuration.
  -p, --password=ARG   password for the org user.
  -n, --netrc          retrieve the username + password from the .netrc file. In lieu of -u/-p
  -o, --org=ARG        the Edge organization.
  -Z, --ssoZone=ARG    specify the SSO zone to use when authenticating.
  -C, --passcode=ARG   specify the passcode to use when authenticating.
  -T, --notoken        do not try to obtain an oauth token.
  -v, --verbose
  -h, --help
  -P, --prior          optional. use the prior (N-1) year or month. Default: the current year/month.
  -d, --daily          optional. collect daily data for the period. Default: collect monthly data.
  -S, --sheet          optional. create a Google Sheet with the data. Default: emit .csv file.
      --start=ARG      optional. starting date in YYYYMMDD or YYYYMM format. Supercedes -P.
  -N, --nocache        optional. do not use cached data; retrieve from stats API