Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HTTP authentication - can't figure it out!  RSS feed

 
joey jojo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to download a file from a website, however, you need to login prior to accessing the file. If I try and access the file using the direct url path, it just redirects me to the login page. The server uses basic authentication.

Here's an example I found on the internet. However, I can't get it to work; it still redirects me to the login page. Am I missing something?

 
Tim Moores
Saloon Keeper
Posts: 3831
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the getPasswordAuthentication method ever being called?

For any HTTP operation more complex than a simple URL access (like if authentication is involved) I'd use the Apache HttpClient library.
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!