Basic Authentication

Table of contents

  1. Description
  2. Constructor properties
  3. Methods
  4. @Example

Description

BasicAuthentication is a class in the context of Alert Notification service node client. It helps you with acquiring the authorization header value, when using Basic Authentication mechanism, in order to authenticate yourself against Alert Notification service. For further information go to Credential Management and select Basic Access Authentication option.

Constructor properties

Field Type Description
username string A tecnical client’s username
password string A technical client’s password

Methods

Name Returns Description
getAuthorizationHeaderValue() string Gets the base64 encoded value of username and password, which will be added in the Authorization Header

@Example

import { BasicAuthentication } from '@sap_oss/alert-notification-client';

const basicAuthentication = new BasicAuthentication({
    username: 'test-username',
    password: 'test-password'
});

basicAuthentication.getAuthorizationHeaderValue()
.then(authHeaderValue => console.log(authHeaderValue))
.catch(error => console.log(error));  // The current call will print the basic authorization header value with encoded username and password in base64 format 'Basic dGVzdC11c2VybmFtZTp0ZXN0LXBhc3N3b3Jk'