Created
March 18, 2014 08:54
-
-
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./..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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