stripe-cli: Storing livemode keys in macOS keychain not working with binary release for arm64

Issue

According to DX7509, the livemode credentials are supposed to be saved in the macOS keychain. This does not work with the binary release for arm64 or when installing via homebrew. Instead, it seems like the library being used for storing credentials (https://github.com/99designs/keyring) is selecting a different ‘file’ credential backend by default:

❯ stripe customers list --live
No directory provided for file keyring

When compiling from source, I get the confirmation pop-up as expected and have to allow access to the keyring. After this, all live commands work as expected:

image

Instead of the mac-os_arm64 binary I also tried using the mac-os_x86_64 binary, there the keychain is working as expected. My guess is, that something is misconfigured with the cross-compilation. Specifically with the cgo support, which seems to be enabled for amd64 but not for arm64. 99designs/keyring is requiring cgo for the keychain to work.

Expected Behavior

I expect the stripe binary installed via brew on arm64 to prompt me keychain access when first accessing/storing credentials. Currently, the only workaround seems to be to manually provide an API key whenever accessing the live environment.

Steps to reproduce

On an Apple Silicon Mac.

  1. Install stripe via homebrew, alternatively use the arm64 binary release:
brew install stripe/stripe-cli/stripe
  1. After logging in, execute any command in live mode:
❯ stripe customers list --live
No directory provided for file keyring
  1. Download and extract the amd64 binary. Execute any command in live mode using this binary. If not allowed yet, a keychain dialog will pop up and prompt to enter the password, the command will succeed as expected:
❯ ./stripe customers list --live
{
  "object": "list",
  "data": [
...
  ],
  "has_more": true,
  "url": "/v1/customers"
}

Environment

stripe: 1.10.4 compile: go1.19 darwin/arm64 with cgo enabled

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 18 (1 by maintainers)

Most upvoted comments

Windows 11 with WSL 2, downgraded to 1.19.5 worked out.

Still happening on WSL, a quick fix is to run the following: sudo apt install gnome-keyring

I use WSL2 and just had the same problem here.

After trying a lot of things without success, it finally worked after when running sudo stripe login instead of stripe login.

I also had to use sudo before other stripe commands to get everything working.

After following the apt install instructions from https://docs.stripe.com/stripe-cli#install on WSL 2 (using Windows Terminal app) and typing stripe login I am successfully redirected and confirm the creation of the restricted key on the browser. The terminal reads “Waiting for confirmation…No directory provided for file keyring”.

I can see that the keys have been created in the api keys section of the stripe dashboard they are just not being saved on my local machine. Other stripe documentation states the keys are saved in ~/.config/stripe/config.toml but the directory ~/.config/stripe does not exist.

Update 3 days later:

I tried it again this morning and it works on 1.20.0. The only thing I can suggest that may have fixed it is that after I ran a fix suggested above, sudo apt install gnome-keyring, I may not have restarted the WSL instance.

I suddenly started getting this error with stripe 1.20.0 after never having experienced it before. I downgraded back to 1.19.4 the problem went away.

Hi, I’m unfortunately still seeing the same on a headless instance of Ubuntu 22.10 installed both via APT and manually.