martindstone / pagerduty-cli

A command line interface for PagerDuty
MIT License
91 stars 13 forks source link

API token not being accepted #19

Closed sarman-tftsr closed 2 years ago

sarman-tftsr commented 2 years ago

Using PagerDuty-cli I am unable to run any successful commands after authentication. Here you can see where I DID authenticate: bash-5.0$ pd login Checking token 63cfdeaf27dba22df31fb3aeea4abcba6ce81ceac51d2f51d22154b9996ca5e4... done Domain added - you are logged in to ecws as shaun.arman@motorolasolutions.com Next, when trying any pd command, I get the following error: bash-5.0$ pd incident:list › Error: No PagerDuty authentication was found › Try this: › * pd auth:set › * pd login

I am using the latest version of pager duty-cli: bash-5.0$ pd -v pagerduty-cli/0.0.74 linux-x64 node-v16.12.0 My current version of nodes and NPM bash-5.0$ node -v v16.12.0 bash-5.0$ npm -v 8.1.0 My OS: NAME=Fedora VERSION="33 (Server Edition)" ID=fedora VERSION_ID=33 VERSION_CODENAME="" PLATFORM_ID="platform:f33" Linux msi-vm 5.14.13-100.fc33.x86_64 #1 SMP Mon Oct 18 12:36:04 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

sarman-tftsr commented 2 years ago

I will also add that I am running this on a Mac also, but do not have any issues on the Mac.

jdstone commented 2 years ago

I am having the same problem on macOS. Both pd login and pd auth:set seem to succeed, but then there is no authentication in the list and all pd commands fail with Error: No PagerDuty authentication was found.

pagerduty-cli version: pagerduty-cli/0.0.74 darwin-x64 node-v16.11.0 Operating System: macOS Catalina 10.15.7

$ pd login
Waiting for browser authentication... failed
Authentication failed
Checking token <TOKEN REDACTED>... done
Domain added - you are logged in to example as jd@example.com

$ pd auth:list
 ›   Error: You are not logged in to any PagerDuty domains
 ›   Try this:
 ›     * pd auth:set
 ›     * pd login

$ pd incident:list
 ›   Error: No PagerDuty authentication was found
 ›   Try this:
 ›     * pd auth:set
 ›     * pd login
$ pd auth:set
Enter a PagerDuty API token: <TOKEN REDACTED>
Checking token... done
You are logged in to example as jd@example.com (alias: example)

$ pd auth:list
 ›   Error: You are not logged in to any PagerDuty domains
 ›   Try this:
 ›     * pd auth:set
 ›     * pd login

$ pd incident:list
 ›   Error: No PagerDuty authentication was found
 ›   Try this:
 ›     * pd auth:set
 ›     * pd login
maxchen-000 commented 2 years ago

For me, it's working on MacOS, but it's not working on Linux container running "Ubuntu 20.04.3 LTS". Same behavior as above where pd auth:set works, but all other pd commands failed

martindstone commented 2 years ago

Thank you all for reporting this... I am investigating and should have some info soon...

martindstone commented 2 years ago

I am using the latest version of pager duty-cli: bash-5.0$ pd -v pagerduty-cli/0.0.74 linux-x64 node-v16.12.0 My current version of nodes and NPM bash-5.0$ node -v v16.12.0 bash-5.0$ npm -v 8.1.0 My OS: NAME=Fedora VERSION="33 (Server Edition)" ID=fedora VERSION_ID=33 VERSION_CODENAME="" PLATFORM_ID="platform:f33" Linux msi-vm 5.14.13-100.fc33.x86_64 #1 SMP Mon Oct 18 12:36:04 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

@sarman-tftsr can you tell me if you installed using the "easy install" from the user guide, or manually using npm install?

martindstone commented 2 years ago

@sarman-tftsr @maxchen-000 @jdstone it seems like in some cases the configuration directory is not being created when it doesn't exist. Can you check whether ~/.config/pagerduty-cli exists, and if it does not, then mkdir -p ~/.config/pagerduty-cli and then try pd auth:set again? I will work on a fix for what I have observed but it would be good to know if it's the same problem you all are dealing with. Thanks!

martindstone commented 2 years ago

OK this should be fixed now, I just uploaded 0.0.75, can you let me know if yall are still having any trouble with it?

jdstone commented 2 years ago

@martindstone I just manually created the ~/.config/pagerduty-cli directory prior to installing v0.0.75 and that did fix it. I then removed pagerduty-cli and installed v0.0.75 and of course, it's fixed in there as well. So thank you very much for your quick response and fix.

maxchen-000 commented 2 years ago

both the manual workaround and the new version worked for me too. Thanks.

sarman-tftsr commented 2 years ago

I tested on one fedora system and it now works. Thanks for the fast turnaround on this!