0
我的代码是:401擅自城市飞艇错误的Android
String encodedData = Base64.encodeBytes("YxxxxxxxxxxxxxxxA".getBytes());
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC);
HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC);
HttpClient client = new DefaultHttpClient(httpParams);
HttpPost request = new HttpPost("https://go.urbanairship.com/api/airmail/send/broadcast/");
//request.setHeader(header)
request.addHeader("Authorization", "Basic " + encodedData)
正在使用的应用程序的主秘密按照该文件建议在这里:
http://urbanairship.com/docs/richpush.html?highlight=broadcast
但我得到401未经授权错误。
如何解决这个问题?
谢谢
是的主秘密是通过,我检查它的正确,但是这种身份验证的方式.. – Udaykiran
呃,这是2016年,我现在有这个问题。没有人似乎有答案:http://stackoverflow.com/questions/35664399/how-come-i-keep-getting-a-request-failed-with-response-code-401-when-trying-to – Silverstar