How to avoid getting a password prompt when downloading XLS/CSV reports from Cockpit

Problem

If you have been using Cumulocity IoT for a longer time and utilize the report functionality in Cockpit to create XLS/CSV you have probably noticed that after you click the download link and it opens in the browser, you will get a password prompt.

This is because your download link probably looks like this:

/inventory/binaries/12345

This is a direct call to the API, which will see that there is no authentication and therefore returns this prompt to please authenticate yourself.

Note: These configurations can only be done in management or enterprise tenants. Standard tenants will automatically inherit this configuration from their parent tenant and cannot set it themselves.

Solution

You can completely avoid this by changing the link to the cockpit application to look like this:

/apps/cockpit/index.html#/?download=12345

This will not call the API but open the Cockpit application and then trigger a plugin there for the download. This means if you are already logged into Cumulocity IoT in your browser, there is no need to enter your credentials again, and you can go straight for the download.
If you even decide to disallow Basic Authentication from web browsers for your tenant, you will have to use the second method, as the first one will use Basic Authentication and you will get an error.

In order to change this you can go in your management or enterprise tenant to the Administration application. Go to Settings > Enterprise Tenant > Configuration and look for the entry of “Data Export”. Here you can configure the email that you will receive for downloading exports.
A simple version could look like this:

File with exported data can be downloaded from  {tenant-domain}/apps/cockpit/index.html#/?download={binaryId}

Enjoy downloading your exports hassle-free, especially without a password prompt that cannot be filled out by password managers :wink:

6 Likes

Worth reading. Thanks for sharing. Keep it up.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.