Downloading a file from https with basic authorization


#1

Hi Yall!
I’m trying to download a file using the downloadItem.

i’m able to download files from public sites like http://mysite.com/data/file.txt
but what if i have a basic authentication and a https protocol?

in the same app i can access to that folder using a basic authentication, even calling the url like https://user:password@mysite.com/data/file.txt and sending additional headers like ‘rejectUnauthorized:false’ etc…

how can i make the downloadURL function work with auth and https?!

thanks


#2

Hi,

did u checked https://github.com/electron/electron/blob/master/docs/api/app.md
Event: 'login' you may get some idea to send username and password

if it is ldap/ntlm auth then try this

session.defaultSession.allowNTLMCredentialsForDomains('*'); // in ur main.js

or try both


#3

Nope :frowning:

the first one doesen’t look like the one i need. I’m mostly able to make a basic authorization like https://user:pwd@site.com, the part that i’m missing is sending the extra headers like rejectUnauthorized:false

the second one is not suitable for my case :confused: