且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用kso​​ap2-机器人订阅到SharePoint Web服务时的错误身份验证

更新时间:2023-11-07 19:48:28

也许尝试以下操作:

String authentication = android.util.Base64.encodeToString("username:password".getBytes(), android.util.Base64.NO_WRAP);

默认情况下,Android版的Base64 UTIL增加了一个换行符的EN codeD字符串的结尾。这种无效的HTTP头和导致错误的请求。

By default the Android Base64 util adds a newline character to the end of the encoded string. This invalidates the HTTP headers and causes the "Bad request".

Base64.NO_WRAP 标志prevents这一点,并保持头在机智。

The Base64.NO_WRAP flag prevents this and keeps the headers in tact.