I'm trying to show a PDF located in http://myserver.com/my_file.pdf. There is a basic auth for that endpoint. I'm doing this:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://myserver.com/my_file.pdf"));
Bundle bundle = new Bundle();
bundle.putString("Authorization", "Basic xxxxxxxxxxxxxxxxxxxx");
intent.putExtra(Browser.EXTRA_HEADERS, bundle);
startActivity(intent);
But when I debug the server side, there is no header Authorization
in the request so I get 401 Unauthorized.
What am I doing wrong?
As you cannot share exact url, I would suggest you to open this inside a webview in your app.