你如何从Magento的REST API令牌获取用户的id? [英] How do you get a user's id from a Magento REST API token?

查看:153
本文介绍了你如何从Magento的REST API令牌获取用户的id?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着<一个href=\"http://www.magentocommerce.com/api/rest/authentication/oauth_configuration.html#OAuthConfiguration-ViewingAuthorizedTokens\"相对=nofollow>这些说明,可以很容易地看到,Magento的是他们授予后的用户ID的OAuth凭证关联。有鉴于OAuth令牌的方式来以编程方式恢复用户ID,?

Following these instructions, it's easy to see that Magento is associating the OAuth tokens with a user id after they're granted. Is there a way to programmatically recover the user id, given the OAuth token?

推荐答案

如果有帮助,你可以做这样的:

If helps, you can do it like this:

// Should be a collection of one element (or zero if nothing found)
$tokens = Mage::getModel('oauth/token')->getCollection()->addFilterById($tokenId);
foreach ($tokens as $token) {
    echo $token->getCustomerId();
}

这篇关于你如何从Magento的REST API令牌获取用户的id?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆