我正在尝试使用Magento 1.X Rest Api和Oauth lib。 但是当我运行脚本时,我会陷入这个网址:
http://myhost.com.br/admin/oauth_authorize?oauth_token=xxxxxx
此步骤后脚本不会继续运行,并且不会返回到我的localhost网址。我该怎么办?
这是我的剧本
$callbackUrl = 'http://127.0.0.1:8080';
$temporaryCredentialsRequestUrl = 'http://myhost.com.br/oauth/initiate?oauth_callback=' . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://myhost.com.br/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://myhost.com.br/oauth/token';
$apiUrl = 'http://myhost.com.br//api/rest/products';
$consumerKey = 'consumerkey';
$consumerSecret = 'consumersecret';
require_once __DIR__ . '/vendor/autoload.php';
use ohmy\Auth1;
Auth1::legs(3)
->set('key', $consumerKey)
->set('secret', $consumerSecret)
->set(array(
'key' => $consumerKey,
'secret' => $consumerSecret,
'oauth_callback' => $callbackUrl
))
->request($temporaryCredentialsRequestUrl)
->authorize($adminAuthorizationUrl)
->access($accessTokenRequestUrl)
->GET($apiUrl)
->then(function($response) {
echo '<pre>';
var_dump($response->json());
echo '</pre>';
});