Try the Demo

Magento Forum

   
OAuth issue, Android, magento community edition
 
mostrapotski
Jr. Member
 
Total Posts:  1
Joined:  2012-10-01
 

Hello guys,
I m using the fresh magento community 1.7.0.2. I would like to espose services through rest/json. Thus, i need to use OAuth security.
I would like to use signpost since it’s really lightweight. Unfortunately, i can’t get any request token, the sample code below:

CommonsHttpOAuthProvider provider = new CommonsHttpOAuthProvider(DataHelper.REQUEST_TOKEN_ENDPOINT_URLDataHelper.ACCESS_TOKEN_ENDPOINT_URLDataHelper.AUTHORIZE_WEBSITE_URL);
 
provider.setOAuth10a(true);
CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(DataHelper.CONSUMER_KEYDataHelper.CONSUMER_SECRET);
provider.getRequestHeaders().put("oauth_signature_method""HMAC-SHA1");
provider.getRequestHeaders().put("oauth_signature""8oS7G2D0yq0/i4NCKiiytt7wSFs=");
return 
provider.retrieveRequestToken(consumerOAuth.OUT_OF_BAND);

Always return error code 401 with signature_invalid.
It appears magento is in some way not compatible yet with signpost, or am i doing something wrong ? I used the sample code to access other API and it’s just working.

If it’s actually not working, any hint of the best practices? Other ways to use OAuth need 50 jars, i don’t want to start with a 10 megs APK.

Thank you all for your help,

Regards,
Dimitri.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top