如何从 Magento REST API 令牌中获取用户 ID?

编程入门 行业动态 更新时间:2024-10-27 13:26:56
本文介绍了如何从 Magento REST API 令牌中获取用户 ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

按照这些说明,很容易看到Magento 在授予 OAuth 令牌后将其与用户 ID 相关联.给定 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 09:58:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/936297.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌   用户   REST   Magento   ID

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!