At the moment, I have all my ajax requests sending an Authentication token. However, I have created a service for exporting to excel and since ajax doesn't support that, I am using location.href for the get request. Is there a way to include the token in this process?
var getUrl = '/LandingView/ExportToExcel?excelHeader=' + excelHeader;
getUrl += '&companyId=' + $scope.options.companyId;
getUrl += '&startDate=' + $scope.options.startDate.toJSON();
getUrl += '&endDate=' + $scope.options.endDate.toJSON();
getUrl += '&page=' + $scope.options.page;
getUrl += '&stateFilter=' + $scope.options.stateFilter;
getUrl += '&rows=' + $scope.options.rows;
getUrl += '&alertFilter=' + $scope.options.alertFilter;
getUrl += '&mode=' + $scope.options.mode;
getUrl += '&showLanguages=' + $scope.options.showLanguages;
location.href = getUrl;
When I use this method, I need to make sure the bearer token is included in the header.
PS: Just wanted to mention that I am using ASP.NET MVC on the backend and AngularJS on the frontend.