I'm trying to run a script that would get a list of users in bitwarden and output it to a file called bitmembers.
Below is the script where XXXX
is my API bearer token
#!/bin/bash
CURL="/usr/bin/curl"
BITHTTP="https://api.bitwarden.com/public/members"
CURLARGS="-X GET"
header='-H "accept: text/plain" -H "Authorization: Bearer XXXX"'
$CURL $CURLARGS $BITHTTP $header > /tmp/bitmembers
Below is the error I'm getting when script is ran:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: text
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: Bearer
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: XXXX
Below is the curl command and confirmed works:
curl -X GET "https://api.bitwarden.com/public/members" -H "accept: text/plain" -H "Authorization: Bearer XXXX"
It looks like it's breaking down in the header portion. Can you point out what I'm missing?