使用magento api进行用户身份验证

时间:2013-02-06 12:47:18

标签: php api magento

我正在使用此代码对magento上的用户进行身份验证

$redirecturi = 'http://localhost/magento';
$temporaryCredentialsRequestUrl = "http://localhost/magento/oauth/initiate?oauth_callback=".$redirecturi;
$customerAuthorizationUrl = 'http://localhost/magento/oauth/authorize';
$accessTokenRequestUrl = 'http://localhost/magento/oauth/token';

$oauthClient = new OAuth($consumerkey, $consumersecret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
$oauthClient->enableDebug();

$requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
header('Location: '.$customerAuthorizationUrl.'?oauth_token='.$requestToken['oauth_token']);
exit(0);

但它显示致命错误,例如'未找到'Class'OAuth''。我使用此链接进行身份验证magento authentication。 请查看并回复答案。

谢谢..

2 个答案:

答案 0 :(得分:1)

请检查您是否安装了OAUth Extension for PHP。见http://www.php.net/manual/en/oauth.installation.php

答案 1 :(得分:0)

我们使用此链接为php安装oauth。它很好,很容易添加PHP扩展。

Install Oauth Php

我希望它对所有人都有帮助。