3

I followed http://devdocs.magento.com/guides/m1x/api/rest/authentication/oauth_configuration.html

I am able to login to "My first application" with admin.

But not with customer.

I got $_SESSION like

Array
(
    [secret] => 7664a04e54256c135a18b313a9d06872
    [state] => 2
    [token] => fc5be1e6d0cd1cde0ed614281b61894f
)

I got error in this line

$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));

Saying that

Invalid auth/bad request (got a 500, expected HTTP/1.1 20X or a redirect)

Service temporary unavailable

Please help me solve this.

1 Answer 1

8

It seems you should to add "'Accept' => 'application/json'" or 'Accept' => /. So

$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));

should to be

$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => 'application/json'));

or

$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => */*));
1
  • omg, you saved my day !
    – florian-do
    Commented Aug 26, 2016 at 13:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.