极光JMessage 报错401
height="28">="515" height="337"> 发布生产两次 两次晚上出问题,我这个聊天系统平时很稳定,今天晚上突然获取聊天消息失败了 说我401? 查了一圈没有发现问题。 程序员何苦为难程序员呢? 这么晚了 搞什么?
String base64 = getBase64("ae10f874532f3604****59706:d9277****83b62db32e");
// 加密
public static String getBase64(String str) {
byte[] b = null;
String s = null;
try {
b = str.getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (b != null) {
s = new BASE64Encoder().encode(b);
}
return s;
}
conn.setRequestMethod(sendType);
conn.setRequestProperty("Authorization", "Basic "+base64);//YWRtaW46YWRtaW4=");
// 设置访问提交模式,表单提交
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept-Charset", "UTF-8");
conn.setRequestProperty("Charset", "UTF-8");