0

I am using Bold Report Viewer embedded in an Angular application (Angular 13). When loading a report, I get this error:

A network failure, slow connection, or incorrect service information could be the cause. Please verify your network connection and ensure the ReportServerURL, ReportServerCredential, ReportPath, and Authorization Token, then try again. Kindly check the provided authorization token.

Browser Network call fails with 401 Unauthorized error, here, I am sharing the HTTP POST request as a curl(bash) below:

curl 'http://localhost:8090/reporting/reportservice/api/Viewer/PostReportAction' \
  -H 'Accept: application/json, text/javascript, */*; q=0.01' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json; charset=UTF-8' \
  -H 'Origin: http://localhost:4400' \
  -H 'Pragma: no-cache' \
  -H 'Referer: http://localhost:4400/' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-site' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'serverUrl: http://localhost:8090/reporting/api/site/site1' \
  -H 'serviceAuthorizationToken: Bearer <TOKEN WAS GIVEN HERE>' \
  --data-raw '{"reportAction":"ReportLoad","isReloadReport":false,"controlId":"reportViewer_Control","reportPath":"/Sample Reports/Sales Order Detail","enableVirtualEvaluation":false,"smartRendering":false,"reportServerUrl":"http://localhost:8090/reporting/api/site/site1","processingMode":"remote","locale":"en-US","enableSearchText":false,"accessInternalValue":false,"customBrandSettings":{"hideHelpLink":false,"customDomain":"https://help.boldreports.com","customBrandName":"Bold Reports","customLinks":[{"name":"ESLicenseMessage","url":"/licensing/license-token/"}]},"extendedAttributes":{},"localeSettings":{"dateFormat":"","timeFormat":"","timeZone":""}}'

The response body from the report server API contains:

{
  "message": "Access Denied: You are not authorized to access this resource. Please verify your credentials or permissions and try again.",
  "statusCode": 401
}

Angular Component:

// report-viewer.component.html

<bold-reportviewer
    id="reportViewer_Control"
    [reportServiceUrl]="reportViewerServiceUrl"
    [reportServerUrl]="reportViewerServerUrl"
    [serviceAuthorizationToken]="serverServiceAuthorizationToken"
    [reportPath]="reportViewerReportPath"
    style="width: 100%; height: 950px">
</bold-reportviewer>

// report-viewer.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-report-viewer',
  templateUrl: './report-viewer.component.html',
  styleUrls: ['./report-viewer.component.css']
})
export class ReportViewerComponent {
  reportViewerServiceUrl: string;
  reportViewerServerUrl: string;
  reportViewerReportPath: string;
  serverServiceAuthorizationToken: string;

  constructor() {
    this.reportViewerServiceUrl = 'http://localhost:8090/reporting/reportservice/api/Viewer';
    this.reportViewerServerUrl = 'http://localhost:8090/reporting/api/site/site1';
    this.reportViewerReportPath = '/Sample Reports/Sales Order Detail';
    this.serverServiceAuthorizationToken = 'Bearer <TOKEN was given here>';
  }
}

I received the token by the following request.

curl -X POST http://localhost:8090/reporting/api/site/site1/token \
-H 'Content-Type: application/json' \
-d '{
  "username": "[email protected]",
  "password": "dummyPassword123!",
  "grant_type": "password"
}'

serverServiceAuthorizationToken generation

Docker container is running on port http://localhost:8090

Bold Report Admin user

Bold Report Admin user proof

How to resolve this issue and need to understand what went wrong?

I am following these two resources:

Tried to view the report using JavaScript approach: Fails to load and view the report using JavaScript approach

1 Answer 1

1

This issue occurs because the server is hosted on localhost within a Docker environment, which prevents requests from properly reaching services inside the container. To resolve this, the server should be hosted using the IP address of the virtual machine (VM) instead of localhost.

I’ve outlined two possible solutions:

Option 1: Modify Only the reportServerUrl

Update the reportServerUrl property to use localhost as shown below:

http://localhost:6505/reporting/api/site/site1

Continue using the existing URL for the serviceUrl property. This change ensures the report server endpoint is correctly referenced.
ReportserverURL modification

Option 2: Full Configuration Using VM IP

Follow these steps:

Step - 1: Get the IP address of VM machine

Step - 2: Go to the URL http://localhost:8090/ums/administration/proxy-settings and change the proxy URL to VM's IP and save the settings. Please refer the below snap,

Configuration

Step - 3: Restart the docker container.

Step - 4: Configure the domain in the embedded sample and try to run the reports. Please refer below snap,
Application

Sign up to request clarification or add additional context in comments.

2 Comments

I am receiving a 401 Unauthorized response when my Angular frontend (running on port 4400) makes requests to the Bold Reports Server (running in a Docker container on port 8090). Since the Bold Report server responds with a 401, I believe the HTTP request is successfully reaching the Docker container.
The option 1 approach worked for me. However, I would appreciate it if you could elaborate the option 2.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.