I have username
and password
and I want to compute Authorization
header for HTTP Basic Auth. Computed header looks like this: 'Basic xyz123xxx'
. Is there a node package in npm that will allow me to do this?
Use Buffer
to encode the string for use in the header.
Buffer.from(`${username}:${password}`).toString("base64")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With