Skip to content

Instantly share code, notes, and snippets.

@mediavrog
Created March 18, 2014 08:54
Show Gist options
  • Save mediavrog/9616149 to your computer and use it in GitHub Desktop.
Save mediavrog/9616149 to your computer and use it in GitHub Desktop.
When adding Authorization header for use with HttpConnection, beware of the WRAPPING. A wrapped Authorization header will always return 401./..
// the flag Base64.NO_WRAP is essential
public String generateBasicAuthString() {
return "Basic " + Base64.encodeToString(String.format("%s:%s", Utils.deobfuscate(BuildConfig.USER), Utils.deobfuscate(BuildConfig.PW)).getBytes(), Base64.URL_SAFE | Base64.NO_WRAP);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment