0

Overview : I'm trying to make an android application for my college email service. Its hosted by Zimbra, Webmail. Im using Jaunt-Api to scrape data from the website.

My question is: I have the link (url) to the attachment. When I open the link using the following code, I get an HTTP 403 error. This means I have to add a basic authentication to this URL. Ive tried for over 6 hours, gone through many such questions on stackoverflow already but couldnt find an answer. How do I add basic authentication to this code?

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse(currentemail.attatchment_link);
intent.setData(data);
startActivity(intent);

Otherwise, can anybody suggest a direct way to download the attachment on android? (Given, I have the link, I just need to add the authentication which I have struggled for days now!).

Rishabh Bhardwaj
  • 207
  • 5
  • 14

2 Answers2

0

Did you try appending the username and password to the URL itself? https://gooduser:secretpassword@www.example.com/webcallback?foo=bar

atok
  • 5,880
  • 3
  • 33
  • 62
0

Try adding username and password in the beginning of the link like url : www.example.com

try this: www.username:password@example.com

Then use DownloadManager to catch the dowload from the link.

Robert
  • 5,278
  • 43
  • 65
  • 115