/** * Returns a bearer Authorization header value for the given * {@link BearerCredentials} and charset. * * @param credentials The credentials to encode. * @param charset The charset to use for encoding the credentials * * @return A bearer authorization string * * @since 3.0 */ public static String authenticate(BearerCredentials credentials, String charset) { Log_OC.d(TAG, "enter BearerAuthScheme.authenticate(BearerCredentials, String)"); if (credentials == null) { throw new IllegalArgumentException("Credentials may not be null"); } if (charset == null || charset.length() == 0) { throw new IllegalArgumentException("charset may not be null or empty"); } StringBuffer buffer = new StringBuffer(); buffer.append(credentials.getAccessToken()); //return "Bearer " + EncodingUtil.getAsciiString(EncodingUtil.getBytes(buffer.toString(), charset)); return "Bearer " + buffer.toString(); }