I want to retrieve all movie reviews, my application is implemented by java. But I got Invalid Signature for the result
The following is the java code that I use
I'm not sure whether the way I got the oauth_signature is correct or not.... I got it from Mashery's OAuth Signature Validation Tool.
If it is not correct, could anyone give me the right way to generate it....(which part I have to change in the code that I provided)
Well, you're wise to use a library, but i don't think you're using it quite right. Try following the examples under Customer Requests: http://blueleftistconstructor.com/projects/netflix-client/usage.html
As you can see, the library handles building most of the oauth_parameters for you.
The OAuth Signature Validation tool and the OAuth Test Page are there for folks building libraries like the one you want to use.
MoS,
As JR ppinted out, it looks like you're doing more work than necessary. Since you have the an access token for your user, you can use that to build an NetflixAPICustomer object, and pass that along to the makeCustomerAuthorizedApiCall() method -- not the makeConsumerSignedApiCall() method. In neither case should you have to fiddle with any OAuth parameters yourself.
Hope that helps!
Has ANYONE successfully used the BLC NetFlix Java Client library to login to the NetFlix API for a customer and retrieved a proper access token for further queries?! I have beat my head against a wall for days now and I still cannot get this library to work. The Usage documentation is full of holes leaving me to believe that no one has ever gotten this to work. tim.
Much like what we said on the other thread, the problem appears to be that you're only following one step of the OAuth process. Feel free to go through the
Netflix Authorization Walk-Through posted at the top of the Resources page http://developer.netflix.com/page/Resources to see all the steps you need to take.
Remember, according to both our documentation and John's, you need to:
1. Request a Request Token & Secret using your API Key and Secret
2. Use the Request Token & secret along with your API Key & Secret to have the user Login and Authorize your app
3. Once they've logged in and authorized, then you make an OAuth Token request using the Request Token & Secret with your API Key & Secret to get the final token you can use for that user.
Again, go through the Walk Through which will show you the steps required. Then it should be fairly easy to make the calls using John's library.
I want to retrieve all movie reviews, my application is implemented by java. But I got Invalid Signature for the result
The following is the java code that I use
public static void main(String[] args) throws IOException, Exception {
// TODO Auto-generated method stub
String myConsumerKey = "qwbbbmjjpynp8y3byqp32py2";
String myConsumerSecret = "eARpYfcPbz";
NetflixAPIClient apiClient = new NetflixAPIClient(myConsumerKey, myConsumerSecret);
String uri = "http://api.netflix.com/users/T1iyiqATNsueuIBx3CLxj94dQd1FgzkgPgaZ6z7fz4UMA-/reviews;
HashMap<String, String> paraMap = new HashMap<String, String>();
paraMap.put("oauth_consumer_key","qwbbbmjjpynp8y3byqp32py2");
paraMap.put("oauth_token", "T11Xzpp7hLFh77Vv8Di5evgePdhvrHQr02toiSsKPsqmGf9tBgD1Z4197feR1cLx.MWqcgO.D5pyGuEgxyxfOfLA--");
paraMap.put("oauth_nonce","2864671");
paraMap.put("oauth_timestamp","1245461009");
paraMap.put("oauth_signature_method", "HMAC-SHA1");
paraMap.put("oauth_version","1.0");
paraMap.put("oauth_signature","ZjwPlFyDSVcPKom9q%2F6NjEmyj74%3D");
String details = null;
try
{
details = apiClient.makeConsumerSignedApiCall(uri, paraMap, NetflixAPIClient.GET_METHOD_TYPE).getResponse();
System.out.println(details);
}
catch (NetflixAPIException nae)
{
// handle the error...
}
}
I'm not sure whether the way I got the oauth_signature is correct or not.... I got it from Mashery's OAuth Signature Validation Tool.
If it is not correct, could anyone give me the right way to generate it....(which part I have to change in the code that I provided)
Thank you very much
Message edited by MoS 2 years ago
JR Conlin – 3 years ago
Well, you're wise to use a library, but i don't think you're using it quite right. Try following the examples under Customer Requests: http://blueleftistconstructor.com/projects/netflix-client/usage.html
As you can see, the library handles building most of the oauth_parameters for you.
The OAuth Signature Validation tool and the OAuth Test Page are there for folks building libraries like the one you want to use.
John Haren – 3 years ago
MoS,
As JR ppinted out, it looks like you're doing more work than necessary. Since you have the an access token for your user, you can use that to build an NetflixAPICustomer object, and pass that along to the makeCustomerAuthorizedApiCall() method -- not the makeConsumerSignedApiCall() method. In neither case should you have to fiddle with any OAuth parameters yourself.
Hope that helps!
Tim Endres – 2 years ago
Has ANYONE successfully used the BLC NetFlix Java Client library to login to the NetFlix API for a customer and retrieved a proper access token for further queries?! I have beat my head against a wall for days now and I still cannot get this library to work. The Usage documentation is full of holes leaving me to believe that no one has ever gotten this to work. tim.
JR Conlin – 2 years ago
Hi Tim,
Much like what we said on the other thread, the problem appears to be that you're only following one step of the OAuth process. Feel free to go through the
Netflix Authorization Walk-Through posted at the top of the Resources page http://developer.netflix.com/page/Resources to see all the steps you need to take.
Remember, according to both our documentation and John's, you need to:
1. Request a Request Token & Secret using your API Key and Secret
2. Use the Request Token & secret along with your API Key & Secret to have the user Login and Authorize your app
3. Once they've logged in and authorized, then you make an OAuth Token request using the Request Token & Secret with your API Key & Secret to get the final token you can use for that user.
Again, go through the Walk Through which will show you the steps required. Then it should be fairly easy to make the calls using John's library.