Problem with FatSecret's REST API
FatSecret provides two APIs, one javascript and another a REST one. Because the javascript API is limited, I had to start with the REST API. They have an Oauth Scheme going. So, I took my parameters and created a signature, attached it to the url, made an ajax request and Voila! it doesn't work. I keep getting an invalid signature error response. I'm using the following parameters(along with a method to be called and response format) both to create a base string to be used for signature generation and to hit the actual API.
oauth_consumer_key: "MY_KEY"
oauth_nonce: "ABC"
oauth_signature_method: "HMAC-SHA1",
oauth_timestamp: "TIME",
oauth_version: "1.0",
oauth_signature: "WXYZ"
I开发者_StackOverflow中文版 am using a jquery UUID plugin to generate auth_nonce. I don't know what I am doing wrong but I'm fully sure that the signature I am generating is correct.
There is a rubygem that uses an Net::HTTP request which works totally fine. Even when I use the URL that the gem generates, I can't have any success with the jsonp request. But, if I use that URL on the browser(before the oauth_timestamp expires), it works totally fine.
I'll post more details if anyone is going to be interested.
The authentication documentation is available here.
I have been having a tough time getting this API to work for me as well.
This test OAuth test client has helped me to sort out my OAuth errors.
Remember that parameters are sorted using lexicographical byte value ordering, first by name and then by value.
lexicographical example that works in this case:
- oauth_alpha=first
- oauth_batman=second (#2 because of "b" in batman)
- oauth_beta=third (#3 because of "e" in beta)
- oauth_beta=zebra (#4 because of "z" in in zebra)
精彩评论