0

Invalid signature error

I have a token from yahoo API and I need to perform some Rest operation but I'm stuck with signature invalid error
this is my base signature 
GET&http%3A%2F%2Fsocial.yahooapis.com%2Fv1%2Fuser%2FBPKMKY4IXA--------ZYMIIZPCTU%2Fcontacts&%3F
format%3Djson
%26oauth_consumer_key%3Ddj0yJmk9VWd-----------rOU1tNXdiMDFTTnpZbWNHbzlNVGd5TkRJeE16QTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0xMQ--
%26oauth_nonce%3D24829.2331
%26oauth_signature_method
%3DHMAC-SHA1
%26oauth_timestamp%3D1334860368
%26oauth_token%3DA%253D0qIqAnDbvF4MdsW6MiNUiKCgbTY0OuK4omT.dPM0AW1KGgxITmsom8gHelk4VMK6pl7a1Ob2YQXMOg5OSFpxJ0aa1UOyo5gBwjhl2NJVQ2CLeDtrN3qOkF5BaH6vtFmKao3f7h_2l1K7gycUBcLHX1HVM6nNxP45BsBe3MJELKFfrBP4PYb_V9AlvDV5GDAj2MDIiMqSnmS8TlkyQhV.mODIfFHr9ep8IodTlpDNubnBPiRQ4334LiTgUe1ADPc7MxRqHsG423lfqsCFwLfKhS6WzeOR.RMv3rsVLOmtE3puATsHcnQQZOFCUwoyQBGW5h3CISGMJhvPHzEllt8HeXlMEakcYXbK7GfQqtpuHWN0BfN_lrUb63R.vJ1anGXCopM3RXL3Pxi_JUOC7spI1ynKhBFTKfvq8bda0A8rcjh63yREA64JoOCYyUquAe51kyM6CvMzegK7KA4eN8TEu4AomKrq6JixcRyP6ij5TSpqH5z_OmBa4lDoQ_AbXVRTyWNUcJ3l8EfbHcBuH7a84ShpCwDcoIcOnIH_rlZKetnbb5zElvDsjZ4YMxaqZu8JRMhQYEEc17TV.U396lF63N0zy63mGbuXSwTbsgRiSqVAX9vMkAz7O2WRI4kFmwJjADr4kX_Zk2nHj07Os_LMuGFXnHP_URAEN_rQa3U2Su9l4aPEh.WLQOAzpwCuaslKJesOm_ZeRkITU0djDWZcKz2Kn3__B1d5WpvRpZ6jLcsaveqkljaNvKV2k3DVK9KUIKChLA--%26oauth_version%3D1.0

This the request header 
OAuth realm="http://social.yahooapis.com/",
oauth_consumer_key="dj0yJmk9VWdqNU----------------------Zy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0xMQ--",
oauth_nonce="24829.2331",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1334860402",
oauth_token="A%3D0qIqAnDbvF4MdsW6MiNUiKCgbTY0OuK4omT.dPM0AW1KGgxITmsom8gHelk4VMK6pl7a1Ob2YQXMOg5OSFpxJ0aa1UOyo5gBwjhl2NJVQ2CLeDtrN3qOkF5BaH6vtFmKao3f7h_2l1K7gycUBcLHX1HVM6nNxP45BsBe3MJELKFfrBP4PYb_V9AlvDV5GDAj2MDIiMqSnmS8TlkyQhV.mODIfFHr9ep8IodTlpDNubnBPiRQ4334LiTgUe1ADPc7MxRqHsG423lfqsCFwLfKhS6WzeOR.RMv3rsVLOmtE3puATsHcnQQZOFCUwoyQBGW5h3CISGMJhvPHzEllt8HeXlMEakcYXbK7GfQqtpuHWN0BfN_lrUb63R.vJ1anGXCopM3RXL3Pxi_JUOC7spI1ynKhBFTKfvq8bda0A8rcjh63yREA64JoOCYyUquAe51kyM6CvMzegK7KA4eN8TEu4AomKrq6JixcRyP6ij5TSpqH5z_OmBa4lDoQ_AbXVRTyWNUcJ3l8EfbHcBuH7a84ShpCwDcoIcOnIH_rlZKetnbb5zElvDsjZ4YMxaqZu8JRMhQYEEc17TV.U396lF63N0zy63mGbuXSwTbsgRiSqVAX9vMkAz7O2WRI4kFmwJjADr4kX_Zk2nHj07Os_LMuGFXnHP_URAEN_rQa3U2Su9l4aPEh.WLQOAzpwCuaslKJesOm_ZeRkITU0djDWZcKz2Kn3__B1d5WpvRpZ6jLcsaveqkljaNvKV2k3DVK9KUIKChLA--",
oauth_version="1.0", 
oauth_signature="e1546596eb989fc411dfa1492eb101dd31bbe8bf"

by
1 Reply
  • this is my code that I use to generate signature
    String Key=OAuth.percentDecode(AuthentificationParameters.YahooClientSecret)+"&"+OAuth.percentDecode(token_secret);
            // get an hmac_sha1 key from the raw key bytes
            SecretKeySpec signingKey = new SecretKeySpec(Key.getBytes(), HMAC_SHA1_ALGORITHM);
     
            // get an hmac_sha1 Mac instance and initialize with the signing key
            Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
            mac.init(signingKey);
             
    String data =generate_signature_base(url, Method);
            // compute the hmac on input data bytes
            byte[] rawHmac = mac.doFinal(data.getBytes());
            byte[] hexBytes = new Hex().encode(rawHmac);// from the org.apache.commons library
             
            // base64-encode the hmac
            signature = new String(hexBytes,"UTF-8");
    0

Recent Posts

in OAuth General Discussion YDN SDKs