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.

7

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' => */*));
  • omg, you saved my day ! – florian-do Aug 26 '16 at 13:02

protected by Community Oct 3 '17 at 13:06

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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