Search code examples
hyperlinkbasic-authentication

Possible to Send Basic Auth in Link in Java


Is it possible to send basic auth credentials in a link? I have tried http://username:[email protected] but it's not working (in chrome on a mac, it keeps telling me to provide APIKey, which is password in this case). I need to be able to have a user click on a link and provide these credentials, if possible.

The link is to sometimes huge files (< 1 gig). So instead of me, downloading the file in question I would like to just construct a link that points to it, and have the user download it.

It's in Java because I'm making a Java Portlet, but I can construct the link just like an html element:

<a href="https://username:[email protected]">Click here!</a>

Any advice would help, Thanks!


Solution

  • I remember a specific Microsoft support article in which they explicitly dropped browser support for including passwords in URLs like this; it's probable that other browsers did too.

    EDIT: here's the article.