Basic Auth Header
NodeJS
Easy
4 views
Problem Description
Build an Authorization header for basic auth and print it.
Output Format
Print header value.
Constraints
Use Buffer to base64 encode.
Official Solution
const user = 'meetcode';
const pass = '1234';
const token = Buffer.from(user + ':' + pass, 'utf8').toString('base64');
console.log('Basic ' + token);
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!