Android Intent.action_view Basic Authentication
How do I pass along HTTP Basic Authentication information to Intent.ACTION_VIEW? Here's where I'm firing the intent: public class OutageListFragment extends ListFragment implements
Solution 1:
Turns out you can add HTTP headers to the Intent via a Bundle, and specifically add an Authorization header with a Base64 encoded user id.
Intent i = new Intent(Intent.ACTION_VIEW, outageURI);
String authorization = user + ":" + password;
String authorizationBase64 = Base64.encodeToString(authorization.getBytes(), 0);
Bundle bundle = new Bundle();
bundle.putString("Authorization", "Basic " + authorizationBase64);
i.putExtra(Browser.EXTRA_HEADERS, bundle);
Log.d(TAG, "intent:" + i.toString());
startActivity(i);
Post a Comment for "Android Intent.action_view Basic Authentication"