lib/basic-auth.js
function createBasicAuth(username, password) {

  if (!username) {
    throw new Error('<username> required');
  }

  if (typeof password === 'undefined') {
    throw new Error('<password> required');
  }

  const token = base64encode(`${username}:${password}`);

  return auth('Basic', token);
}
function createBasicAuth(username, password) {

  if (!username) {
    throw new Error('<username> required');
  }

  if (typeof password === 'undefined') {
    throw new Error('<password> required');
  }

  const token = base64encode(`${username}:${password}`);

  return auth('Basic', token);
}
function createBasicAuth ( username , password ) { if ( ! username ) { throw new Error ( '<username> required' ) ; } if ( typeof password === 'undefined' ) { throw new Error ( '<password> required' ) ; } const token = base64encode ( ` ${ username } ${ password } ` ) ; return auth ( 'Basic' , token ) ; }
Set username + password credentials on Engine API requests.

@example

Worker(engineEndpoint, {
use: [
BasicAuth('Walt', 'SECRET_PASSWORD')
]
});
Set username + password credentials on Engine API requests .