0

How can I set basic authentication on IMG tag for Ionic?

I have tried using src="http://username:password@server/Path" as suggested on link which works fine with ionic serve in browser, but when uploaded to mobile it doesn't work. I am fetching other resources with authentication header with http request which works fine also.

Any help would be appreciated

Community
  • 1
  • 1
Norgul
  • 4,613
  • 13
  • 61
  • 144
  • Have you whitelisted something like http ://username*/*"? The fact that it works on a browser but not on a device would indicate it's a whitelist problem. – thepio Aug 25 '16 at 10:24
  • Not really...I tried installing cordova whitelist plugin, but it doesn't help – Norgul Aug 25 '16 at 10:54
  • It doesn't help if you just install it. Have you looked at the logs if there's any errors/messages which could be related to this issue? – thepio Aug 25 '16 at 11:06
  • I didn't just install it, I have also added that line of code to config.xml. Where can I see the logs when using phone? – Norgul Aug 25 '16 at 11:39
  • Have you also looked at the Content Security Policy statements? And if you're running an android device you can connect it to your computer and navigate to chrome://inspect/#devices with a Chrome browser to open your application in a tab and see all sorts of stuff, including the logs. – thepio Aug 25 '16 at 11:44

0 Answers0