4

I am trying to access a Magento REST API in my Android app, using Retrofit.

What have I tried:

But none of them have worked.

Retrofit 1.7 and OkHttp2.0RC2 don't work well with SignPost (at least the way the article suggest)

And when I downgrade for things to work, I get error HTTP 500 Error saying Internal Server Error

The same credentials work using REST Client plugin for Firefox.

Is there a working solution for implementing OAuth requests with Retrofit, or any other option?

Much thanks in advance.

Aman Alam
  • 11,231
  • 7
  • 46
  • 81
  • Possible duplicate of [Auth 1.0 oauth\_signature creation Android for magento API](https://stackoverflow.com/questions/49505888/auth-1-0-oauth-signature-creation-android-for-magento-api) – Subin Babu Apr 21 '18 at 08:41

3 Answers3

4

Give it a try to this fix pakerfeldt's signpost-retrofit (A Retrofit extension to oauth-signpost OAuth Core 1.0a standard) !

Other fixes you can try:

LOG_TAG
  • 19,894
  • 12
  • 72
  • 105
3

Turned out that the web server expected the Accept parameter in header, which I was missing but Firefox extension was adding.

That made the server return a 500 (sending a response telling about the error would have been wiser though)

Things are working fine now.

Thanks for giving your time!

Aman Alam
  • 11,231
  • 7
  • 46
  • 81
1

I have tried authenticating using the magento REST api from plain java code using the scribe lib. So far it worked for me.

Dibzmania
  • 1,934
  • 1
  • 15
  • 32