Get Free Trial
API reference
Table of contents

unauthorizederror

[starting from version: 2.8.17]

It is triggered when the Accelerator or the custom data source API server sends the 401 Unauthorized error in response to a Flexmonster’s request. Only for "api" and "microsoft analysis services" data source types.

Data passed to the handler

  • callbackHandler – Function. It can be used to resend the request to the Accelerator or to the custom data source API server. callbackHandler accepts an Object that can have the following parameters:
    • requestHeaders – Object. New request headers can be specified here.

Example

unauthorizederror can be used to automatically refresh authorization headers and resend the request in case of the 401 Unauthorized error:

flexmonster.on('unauthorizederror', function (callbackHandler) {
  // other actions
  // pass new request headers and resend the request
   callbackHandler({
    requestHeaders: {
       AuthToken: "XXX"
     }
});
});

See also

olapstructureerror
queryerror
dataerror