stripe-cli
stripe-cli copied to clipboard
stripe listen "the CLI only supports using a secret or restricted key" error
Issue
I've successfully installed stripe with apt, used stripe login
to get the tokens/secrets and the stripe config --list
shows that everything is there (keys start with "rk_").
When I run stripe listen
I get the CLI only supports using a secret or restricted key
.
Expected Behavior
Output should be something like:
> Ready! Your webhook signing secret is "-secret-" (^C to quit)
Steps to reproduce
I've also tried to download stripe_1.5.1_linux_x86_64.tar.gz (and 1.5.2) from releases page but the output is the same error.
Environment
Linux pop-os/ubuntu:
$ cat /etc/lsb-release
DISTRIB_ID=Pop
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Pop!_OS 20.04 LTS"
Hmm, I'm unable to reproduce this on 1.5.1 or 1.5.2 (on macOS). Couple of follow up questions:
- Does running
stripe listen --api-key rk_test_...
work? - Can you run any command? Like
stripe customers create
? - Can you try setting the keys using
stripe config --interactive
and see if that works? - Are you using xdg for your configs?
I had STRIPE_API_KEY env var which was unrelated (and not intended for) cli.
--api-key
didn't have any effect.
The confusing part is that stripe config --list
doesn't use env. vars (or doesn't give priority to them) but some other commands like listen
do.
We could be more explicit about this. I'm rebranding this as an improvement.
Has this been resolve? When I run stripe login
I am successful in logging in. However when I run stripe listen
I am still getting the the CLI only supports using a secret or restricted key
response. Even if I use stripe login --api-key sk_{...}
it still does not allow for stripe listen
. What am I missing? Thx
I'm tempted to create a new issue...but I think I have a problem that edges close to this. I'm using stripe CLI all commands have worked so far without hitches, so after creating a coupon with stripe coupons create --percent-off 20 --duration once
I get on with it by creating a promotion code with: stripe promotion_codes create --coupon iuWuPNOs --code 20_OFF
This results in the error: {
"error": {
"message": "The provided key 'rk_test_**************************************
*******************************************************blahblah' does not have the
required permissions for this endpoint on account 'acct_some account'. Thi
s is a restricted API key, but the required permissions are not available for us
e by restricted keys.",
"type": "invalid_request_error"
}
}
Has this been resolve? When I run
stripe login
I am successful in logging in. However when I runstripe listen
I am still getting thethe CLI only supports using a secret or restricted key
response. Even if I usestripe login --api-key sk_{...}
it still does not allow forstripe listen
. What am I missing? Thx
I have a similar issue too right now. Slightly different authorization failed error message about only supporting restricted keys in live mode, even though I’m not using the —live flag. I’ve also tried using the global —api-key flag to specify the CLI rk_test key.
Update
I was on WSL2 and closing out my Linux terminal and restarting a fresh one, clearing out my prior created CLI rk_live/test keys, and doing the normal login then stripe listen --forward-to localhost
... again fixed it.
I also had a STRIPE_API_KEY environment variable that was causing this. Deleting it fixed it. Lost hours to this today :(
The issue is still there..
I also had a STRIPE_API_KEY environment variable that was causing this. Deleting it fixed it. Lost hours to this today :(
Same issue, having a project specific .env
var with that variable present for other API calls in the app triggers the error when running the CLI. I'd hoped that using stripe [listen --forward-to 127.0.0.1:8000/...] --config ~/.config/stripe/config.toml
would use the keys generated by the stripe login
command described here, but instead the presence of the env var supersedes this.
At the very least please add a note to the "the CLI only supports using a secret or restricted key" error message that sheds light on what key (location, source) it is using.