interface sap.ui.vk.AuthorizationHandler

Visiblity: public
Available since: N/A
Module: sap/ui/vk/ContentConnector
Application Component: CA-UI5-VTK

Contract for authorization callback function

A callback function which can be implemented by an application to provide an authorization token. Such a function receives a single parameter which is a connection URL and must return a promise which will be resolved to Access Token Response when authorization token is obtained.

A sample implementation of authorization handler:

...
var viewer = new sap.ui.vk.Viewer();
viewer.setAuthorizationHandler(function(url) {
    var headers = new Headers();
    headers.append("Content-Type", "application/x-www-form-urlencoded");
    headers.append("Authorization", "Basic " + basicAuth);

    return fetch(accessTokenUrl, {
            method: "POST",
            body: "grant_type=client_credentials",
            headers: headers
        }).then(response => response.json())
});
...


Events Overview

Event Description