Unplanned
Last Updated: 17 Mar 2021 20:15 by ADMIN
Lukas
Created on: 24 Sep 2020 12:32
Type: Feature Request
8
Pass Bearer Token Authentication with Web Report Designer API Requests
Currently, the auth token is not yet passed from the client to the service. For that reason, it would be nice if the bearer token can be passed with the Web Report Designer API Requests.
1 comment
ADMIN
Eric R | Senior Technical Support Engineer
Posted on: 17 Mar 2021 20:15

Hi Lukas,

Until this gets implemented, I wanted to provide your work around for anyone else that may come across the same issue as it has been appearing more often.

The following code will add the authentication header to each request using the jQuery.ajaxPrefilter() event. 

jQuery.ajaxPrefilter(function (options, originalOptions, jqXHR) {
			jqXHR.setRequestHeader('Authorization', 'Bearer ' + authData.token);
		});

		// overload the fetch method
		const fetchOverride = window.fetch;
		window.fetch = function (url, args) {
			// Get the parameter in arguments
			if (!args) {
				args = {
					headers: {
						Authorization: 'Bearer ' + authData.token
					}
				};
			} else if (!args.headers) {
				args.headers = {
					Authorization: 'Bearer ' + authData.token
				};
			} else {
				args.headers.Authorization = 'Bearer ' + authData.token;
			}

			// Intercept the parameter here
			return fetchOverride(url, args);
		};

Thank you for your patience and understanding while we work to implement this.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.