curl plus basic http auth? quick fix

You need to test the response on your basic http auth’d dev server.  You want to pass it in the header.  You’re on a real computer…

1) Encode your credentials.  Notice passing -n to echo so we don’t get a trailing newline.

  • $ echo  -n ‘<username>:<password>’ | openssl enc -base64
    • feel free to verify $ echo -n ‘foo:bar’ | openssl enc -base64 | openssl enc -base64 -d

2) Send request

  • $ curl <url> -h “Authorization: Basic <encoded_cred_string>”