【问题标题】:How do you get a user's id from a Magento REST API token?如何从 Magento REST API 令牌中获取用户 ID?
【发布时间】:2013-09-08 05:03:31
【问题描述】:

these instructions 之后,很容易看到 Magento 在授予 OAuth 令牌后将其与用户 ID 相关联。给定 OAuth 令牌,有没有办法以编程方式恢复用户 ID?

【问题讨论】:

    标签: api magento rest oauth token


    【解决方案1】:

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

    // 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();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-27
      • 2023-04-08
      • 1970-01-01
      • 2023-01-10
      • 1970-01-01
      • 2016-06-21
      • 2020-05-05
      相关资源
      最近更新 更多