I am having a very difficult time trying to get XAuth working in my
BlackBerry app.  I have downloaded twitterapime the hmacsha ecodingand
Base64Ecoder did not seem to work for me so I replaced the
getSignature method in XAuthSigner with...

/**
         * <p>
         * Generate a signature from the given base string.
         * </p>
         * @param baseString Base string.
         * @param consumerSecret Consumer secret.
         * @param tokenSecret Token secret.
         * @return Signature.
         */
        private static String getSignature(String baseString, String
consumerSecret,
                String tokenSecret) {
//              byte[] b = HMAC.getHmac(baseString, consumerSecret + '&' +
tokenSecret);
//              //
//              return Base64Encoder.encode(b);
                String ret = null;
                try {
                        ret = hmacsha1(baseString, consumerSecret + '&' + 
tokenSecret);
                } catch (Exception e) {
                        new RuntimeException(e.getMessage());
                }
                return ret;
        }


        private static String hmacsha1(String key, String message)
        throws CryptoTokenException, CryptoUnsupportedOperationException,
IOException {
              HMACKey k = new HMACKey(key.getBytes());
              HMAC hmac = new HMAC(k, new SHA1Digest());
              hmac.update(message.getBytes());
              byte[] mac = hmac.getMAC();
              return Base64OutputStream.encodeAsString(mac, 0,
mac.length, false, false);
    }

and any  base 64 encodings with Base64OutputStream.encodeAsString(mac,
0, mac.length, false, false);

I get 401 errors when attempting to get my request token.

I can replace my secrets, ids and pass with dummys and place a step by
steps of what is going on if that would help?

Reply via email to