Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

uni_t's avatar
Level 8

Integrating magento api in Laravel 5.7 + small OAuth issue

Hi all,

I'm trying to connect to magento's api in a simple controller and route 'callback' but it doesn't give me the oauth_token although the code is basically the same as the gist file but replaced the $_GET['oauth_token'] with $request-> oauth_token for example and the sessions with a global session helper etc. And I also add the header verify to false because of recent guzzle curl CA certificate issue, so many fixes on the internet, none of them work. :( It's just temporarily.

When I put the gist file in public folder and create a new OAuth Consumer to this path it works immediately.

see line 34 https://gist.github.com/rafaelstz/4259811d7dae9f34a80898dd68ab2496

In magento you basically create an OAuth Consumer, replace the variable values in the php file, it's 3-legged authentication and sometimes a bit of a pain in the ass with guzzle and OAuth.

You have to be logged in (magento) as customer or admin to authorize the token by the way.

If someone could help me with that, that would be great.

Besides that: with best practices, how would you integrate this into laravel not cluttering every controller method with authentication code? My guess is with middleware, don't know how yet. So before I start on that maybe you guys have a better idea.

0 likes
0 replies

Please or to participate in this conversation.