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