Displaying images from URL that require authentication in UI Page

Mike50
Kilo Guru

Hello Community,

I am trying to sort out the problem associated with the UI Page and images coming from the external source.

Images are coming from a resource/site where basic authentication (user/pass) is required. If I try to load them in my UI Page in ServiceNow, I am getting the 401 'Unauthorized' error, unless I log in to the external site e.g. in a separate browser tab (then, images get loaded correctly in ServiceNow).

I am wondering if there is any way to authenticate to that external resource from the UI Page script, so that images get loaded in the UI Page straight away and user does not have to perform any additional actions.

I was trying to include image URLs in the following format: <img src="https://user:pass@url">, however, this does not seem to work in all browsers and can be considered as insecure.

Do you know if there is any way to solve this problem (e.g. authenticate from the Client script)?

Thank you in advance for your help!

2 REPLIES 2

Cris P
Tera Guru

Hello, can you not store the images in the image table, on your instance?

Hello,

thank you for your answer. This option is not preferred, because the images are created dynamically and there are quite many of them.