Comments (8)
Hi Nir Banerjee,
The endpoint will result in a 403 when the MAGENTO_AUTH_METHOD
is not set to oauth
, but since you have, I think it may have to do with caching.
Could you try to clear all caches?
php artisan optimize:clear
from laravel-magento-client.
Hi There!
Thank you for the tip.
I have already tried that, it didn't help.
In fact I use a small shell script which I execute whenever any change is made, essentially it does:
php artisan optimize:clear && php artisan cache:clear && php artisan route:clear && php artisan config:clear && php artisan view:clear && php artisan event:clear && npm run build
Thank you anyway.
Is it only me or anyone else also faced similar problem? Cause I couldn't find any similar issue in repo issues.
Any pointer to get this resolved will be very helpful.
Thank you
Regards
Nir
from laravel-magento-client.
We have not received any issues regarding this before.
Magento 2 will post to the callback
endpoint first. This way, Laravel knows what credentials to accept to establish an OAuth 1 connection. The output in your log file may suggest that this call has failed.
Do you have a Magento2 OAuth secret file in your Laravel project? It is by default located at:
./storage/app/secret/magento2_oauth.json
The callback
endpoint does not have any middleware except the authentication method check I've mentioned in my previous response.
If the file is missing, could you try to hit the callback
endpoint manually?
curl --include --request POST \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '{"oauth_consumer_key": "x", "oauth_consumer_secret": "x", "oauth_verifier": "x"}' \
http://localhost/magento/oauth/callback
You should get a 200 status code and magento2_oauth.json
should be filled.
from laravel-magento-client.
Thank you for the suggestion.
No, magento2_oauth.json file was not created.
But when I executed below, as per your advise:
nir@Nirjhareswars-MacBook-Pro ~ % curl --include --request POST \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '{"oauth_consumer_key": "x", "oauth_consumer_secret": "x", "oauth_verifier": "x"}' \
https://intranet_dev.artee.test/magento/oauth/callback
HTTP/1.1 200 OK
Date: Mon, 17 Jul 2023 06:13:53 GMT
Server: Apache/2.4.57 (Unix) OpenSSL/3.1.1 PHP/8.1.21
X-Powered-By: PHP/8.2.8
Cache-Control: no-cache, private
Transfer-Encoding: chunked
Content-Type: application/json
[]% nnnnnnnnninnnnnnnnnnnnir@Nirjhareswars-MacBook-Pro ~ % php -v
PHP 8.1.21 (cli) (built: Jul 13 2023 08:13:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.21, Copyright (c) Zend Technologies
with Zend OPcache v8.1.21, Copyright (c), by Zend Technologies
It created the file storage/app/secret/magento2_oauth.json
{"callback":{"oauth_consumer_key":"x","oauth_consumer_secret":"x","oauth_verifier":"x"}}
Does it mean magento failing to execute the request? But debug log shows the request was sent.
Not sure if this is important, my laravel install uses jetstream and auth is handled by laratrust, but I have not added any middleware in this package, yet.
Kindly advice.
Thank you,
Nir
from laravel-magento-client.
The issue is probably due to the self signed certificates I am using for both local domains, though the certificate is added into keychain but seems Magento's laminas http client and adapter is enabled with ssl verification which is causing the problem.
from laravel-magento-client.
I've installed a fresh copy of Magento 2.4.6 and I can activate the OAuth integration.
Do you get any errors from cURL? Could you perhaps add a dd
in the read
-method?
// ./vendor/magento/framework/HTTP/Adapter/Curl.php
public function read()
{
$response = curl_exec($this->_getResource());
if ($response === false) {
dd(curl_error($this->_getResource()));
return '';
}
...
}
from laravel-magento-client.
Okay, so first I added dd and the mage admin won't load, throwing error:
"SSL certificate problem: self-signed certificate"
Commented the dd line, admin opens fine, navigated to the step just before activation, I mean till the "Allow" step in integration activation, then enabled dd line.
Next mage admin shows a popup, saying: "Sorry, something went wrong. Please try again later."
Probably because it was not getting the formatted response from server.
Inspected the url which was returning malformed data:
https://m2.artee.test/mage_admin/admin/integration/tokensExchange/id/1/reauthorize/0/key/d87d92bcd44b3ab41c39665356ac12347f478a43405837ee4fde07b040075b71/?form_key=yqnQhOWDQQssncgk&_=1689583141503
And response was same:
"SSL certificate problem: self-signed certificate"
So now we know the problem. But, the certificate is already in keychain and no browser (safari, chrome, brave, FF dev edition) complains opening the urls (both laravel and mage).
But how do I override this? I need to get this rolling on my dev environment. Live deployment should not create any problem since both live domain have proper SSL, but for testing I must get it running on local.
Is modifying core file(s) is the only way out?
Thank you
from laravel-magento-client.
I'm not really sure what the best options are to accomplish this. Since it's a self-signed certificate and you're working locally, the easiest solution would be to just use HTTP instead.
Otherwise, I'm afraid you may have to modify these files directly or make use of a patch. Note that disabling any certificate checks defeats the purpose of using SSL in the first place.
I think it's also safe to say that this isn't an issue with the library itself. I'm closing the issue. Feel free to reopen it if any problems occur aside from SSL.
from laravel-magento-client.
Related Issues (13)
- Lazy method
- Searching Customers HOT 2
- It can't be installed with Laravel 10 HOT 3
- Cant filter created_at by orders HOT 2
- Select items - searchCriteria HOT 2
- how send token client , To get the customer's data HOT 1
- Dependency Injection - newbie question HOT 3
- How to create instance with manual credentials? HOT 1
- Bulk Support HOT 2
- Missing query parameters HOT 4
- Connecting magento2-Laravel HOT 4
- Sort results when retrieving orders HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-magento-client.