Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: OAuth / OAuth workaround?

[ Edited ]

Hi Klerrison-

 

I'm still receiving the 401, Invalid Signature...

 

 

GET&http%3a%2f%2fapi.netflix.com%2foauth%2frequest_token&oauth_consumer_key%3d5xpsty524wuc2pkkmz2ne3qf%26oauth_nonce%3d5028662916445050177%26oauth_signature_method%3dHMAC-SHA1%26oauth_timestamp%3d1264133371%26oauth_version%3d1.0

 

http://api.netflix.com/oauth/request_token?
oauth_consumer_key=5xpsty524wuc2pkkmz2ne3qf
&oauth_nonce=5028662916445050177
&oauth_signature=Ko%2fHZGM%2bhEKLEmjIP7MwcqP%2fQrM%3d
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1264133371
&oauth_version=1.0

 

I have checked the following parameters parameters: oauth_nonce, timestamp, consumer_key, oauth_version, oauth_signature_method, and they are all correct.

 

Therefore, I have deduced that the issue must be with the oauth_signature value. I went through the code in the signature() method, and I cannot find what the problem is. Everything I posted above looks correct. If it is not a problem with the oauth_signature() method, then it has to be an issue in the communication between the consumer and the service...

 

So, I find myself stuck and frustrated! Any ideas on testing the signature and/or the communcation?

 

Thanks...

Developer
Posts: 78
Registered: ‎12-03-2009
My Device: Not Specified

Re: OAuth / OAuth workaround?

Hey Dude!

 

In order to test your signature and parameters try Google OAuth Playground (http://googlecodesamples.com/oauth_playground/). Check whether your application is generating the same result, what are different or weird Smiley Wink

 

About the communication I'm not the right person to help you, but try to capture the network traffic (wireshark under windows) and read carefully the Peter_Strange stick thread about Network at our forum.

 

Integrating third party applications are not easy at all...

Hope you 

--
Feel free to press the kudos button on the left side to thank the user that helped you.
Please mark posts as solved if you found a solution.
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: OAuth / OAuth workaround?

Hey Klerrison,

 

I've got it! Finally, a response code of "200" Smiley Happy

 

The issue was the hexadecimal values returned from URLUTF8Encoder were lowercase - and Netflix requires that they are uppercase. I simply modified the hex array so that the values were uppercase, and voila...

 

I cannot thank you enough for sticking with me through this process and providing me with so much help. My girlfriend says that I should send you a fruit basket, haha.

 

I've still got a big project ahead of me, and I'm sure I'll be posting more - hope to see you again on the forum!

 

Thanks,

 

Kevin

Developer
Posts: 142
Registered: ‎06-26-2009
My Device: Not Specified

Re: OAuth / OAuth workaround?

Hi klerisson,

 

i am trying to implement the twitter OAuth but could not succeded. i searched lot for any libraries for OAuth but they are not supported for blackberry. Finally i came across your post as u mentioned u got Oauth  worked so please i need ur help.

 

I have used your code which you have posted on this thread. when i am hitting requestToken() method getting 401(Unauthorized) error code. As i see all the parameters m passing properly but couldnt able to understand where m going wrong.

 

here is the what i am passing.

-------------------------------------------------------------------------------------------

Request_Token_URL: http://twitter.com/oauth/request_token


POST&http%3a%2f%2ftwitter.com%2foauth%2frequest_token&oauth_consumer_key%3dd7KhLaOnaOR3RuOsfob7cg%26oauth_nonce%3d5756352732777558983%26oauth_signature_method%3dHMAC-SHA1%26oauth_timestamp%3d1270115236%26oauth_version%3d1.0

Header: oauth_consumer_key=d7KhLaOnaOR3RuOsfob7cg,oauth_nonce=5756352732777558983,oauth_signature=BwPqMMGf%2fRrZtEOK8%2bd2F4tA8aE%3d,oauth_signature_method=HMAC-SHA1,oauth_timestamp=1270115236,oauth_version=1.0

Header1: http://twitter.com/oauth/request_token?oauth_consumer_key=d7KhLaOnaOR3RuOsfob7cg&oauth_nonce=5756352...

---------------------------------------------------------------------------------------------------------------------------------------

 

If you want i can share my code.

 

 

Thanks,

amsiddh.

Developer
Posts: 78
Registered: ‎12-03-2009
My Device: Not Specified

Re: OAuth / OAuth workaround?

Hey amsiddh!

 

It looks like that at least one character is wrong in your header or paramenters' values. Did you check them usiing Google OAuth Playground (http://googlecodesamples.com/oauth_playground/)? Check one by one, otherwise if you are sending something wrong you always will end up facing 401 response code. Pay attention to capital letters, special characters like "+", "/", "\" and so on.

 

About the code above take care using it! It was just something that I made up pretty quickly just to check the feasability of one project. It's not a producition code, but should have to work! Smiley Wink

 

Keep going!

Klerisson

--
Feel free to press the kudos button on the left side to thank the user that helped you.
Please mark posts as solved if you found a solution.
Developer
Posts: 142
Registered: ‎06-26-2009
My Device: Not Specified

Re: OAuth / OAuth workaround?

Hi Klerisson,

 

Thanks for ur reply .....

 

i could not able to reply back due to project deadlines. You are right it was some problem with signature encoding. i fixed it, now my code is working.

 

Really thanks a lot your code has actually helped me for OAuth implementation.

 

Thanks

amsiddh..  Smiley Happy

New Contributor
Posts: 4
Registered: ‎05-19-2010
My Device: 8300
My Carrier: Vodafone

Re: OAuth / OAuth workaround?

hi amsiddh,

I am getting the same error.(401)

How did u fix the signature issue.

 

regards

balu

Developer
Posts: 142
Registered: ‎06-26-2009
My Device: Not Specified

Re: OAuth / OAuth workaround?

Hi balu,

 

First make sure ur consumerKey and consumerSecret are proper. In URLUTF8Encoder class make the hexadecimal string array to capital letter. Just replace small alphabets into capital. check with this.

 

regards,

amsiddh

New Contributor
Posts: 4
Registered: ‎05-19-2010
My Device: 8300
My Carrier: Vodafone

Re: OAuth / OAuth workaround?

HI

The issue was with the hexadecimal values returned from URLUTF8Encoder were lowercase.

changed it to Caps and got response code 200 Smiley Happy

 

regards

balu

Developer
Posts: 137
Registered: ‎09-30-2009
My Device: Torch 9800

Re: OAuth / OAuth workaround?

First I had to change the URL8UTFencoder so that it returns caps lock texts. After that twitter worked.

 

But what I found that I was not able to publish status updates more than one word. That was also the URLEncoder issue. The URL encoder I was using produced spaces as + not as %20. After changing that twitter worked. It was a very hard nut to find

 

 

----------------------
Press like if you find a message helpful
---------