1

I am following the OAuth token exchange example here running on Magento 2.4.1 on MAMP

I created an integration and copied the 4 PHP files at the root of the server. I create an integration and set it with:

Callback URL : http://magento2:8888/endpoint.php Identity link URL : http://magento2:8888/login.php

Then upon activation it opens a pop up and I click login then immediately see this error:

Fatal error: Uncaught OAuth\Common\Http\Exception\TokenResponseException: file_get_contents(http://magento2:8888/oauth/token/request): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /code/MAMP/magento2/vendor/lusitanian/oauth/src/OAuth/Common/Http/Client/StreamClient.php:73 Stack trace: #0 /code/MAMP/magento2/vendor/lusitanian/oauth/src/OAuth/OAuth1/Service/AbstractService.php(52): OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), '', Array) #1 /code/MAMP/magento2/checklogin.php(26): OAuth\OAuth1\Service\AbstractService->requestRequestToken() #2 {main} thrown in /code/MAMP/magento2/vendor/lusitanian/oauth/src/OAuth/Common/Http/Client/StreamClient.php on line 73

What am I missing??

1 Answer 1

0

Issue was that Authorization Header wasnt getting processed correctly by the Apache Server and had to add this to Apache config file:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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