Hello,
I want to
apply from 'https://my-server.com/common.gradle'
but there is a basic auth enabled, so I get 401. How can I provide credentials?
Thank you.
Have you tried putting the credentials in the URL?
example: https://username:password@example.com/common.gradle
Yes, I tried. I.e. if I open http://user:pass@server.com/file in Chrome incognito, it works - file is downloaded immediately, but if put url into gradle file, I see in console that it goes to same url, but gets 401 as usually :
Also password is not smth I would like to be printed out
Try setting up an Authenticator: https://docs.oracle.com/javase/8/docs/api/java/net/Authenticator.html
This sets the default Authenticator and will be used in all requests, so be mindful of that.
e.g.
Authenticator.setDefault (new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication (aUsername, aPassword.toCharArray());
}
});
Thank you very much. I understand that it affects all the requests, but currently works for my setup. Still a blank in gradle api, but at least it can be done.