Invalid_client error using apikey

I have a bash script that I have used in the past to establish a BW session and retirieve passwords for automated workflows. I haven’t used the script in 6 months - now when I am trying to resurrect it, I keep getting the error below.

I have made sure to trim whitespaces and I even rotated the key in case the old key was invalidated somehow but still I get the same error. Finally, I used the bw login --apikey from the command line, copying and pasting the client_id and client_secret and still I am getting the error so its not my script.

EDIT: If I use ‘bw login’ from the command line and manually type my email address and master password, it works. My Bitwarden install sits behind Cloudflare, I wonder if that has anything to do with it. Is there any log I can review?

Any guidance would be appreciated.


Figured it out. There were 2 issues:

  1. NGINX config was allowing an incorrect host (although it rarely changes, I don’t have a static IP and it changed from 6 months ago)
  2. bw config server was changed to default value of (no idea how this happened? during an update?)

Anyway, my automated workflows are back online.


Is it possible to share your script.
I am currently working on a CLI related development and I would be very interested in using your script. Of course, I will share my development with you if you wish. I work with PHP.