I'm trying to make a blackberry app that gets your friends timeline. However I keep getting the 401 unauthorized error on any attempt I make. I am using the same code as the open source BBTweet so I don't understand why this doesn't work for me. The username and password are correct. If I copy and paste them into the twitter login page it works fine. Do I need to sign up somewhere to get this to work? AuhenticationHash is not null either I tried printing it out.
ENCODING: byte[] toEncode = ("username:password").getBytes(); ByteArrayOutputStream newHash = new ByteArrayOutputStream (toEncode.length); Base64OutputStream base64OutputStream = new Base64OutputStream (newHash); try { base64OutputStream.write(toEncode, 0, toEncode.length); base64OutputStream.flush(); base64OutputStream.close(); } catch (Exception ioe) { } authenticationHash = newHash.toString(); GET: StreamConnection s = (StreamConnection)Connector.open("http:// twitter.com/statuses/friends_timeline.xml", Connector.READ_WRITE, true); sendConn = (HttpConnection)s; sendConn.setRequestProperty (HttpProtocolConstants.HEADER_AUTHORIZATION,"Basic " + authenticationHash); sendConn.setRequestMethod("GET");