gpt4 book ai didi

php - 如何从 Magento 1.7 REST API 获取访问 token 和访问 token secret

转载 作者:IT王子 更新时间:2023-10-29 00:13:19 24 4
gpt4 key购买 nike

我已经在我的 magento 管理员上注册了我的应用程序。

已经得到Consumer Key和Consumer Secret。

但我没有运气获得访问 token 和访问 token secret 。

它说

oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key

Simple REST API

我正在基于此链接进行测试

http://www.magentocommerce.com/api/rest/testing_rest_resources.html

我需要知道的答案是

  1. 我必须在标题和数据文本字段中填写什么?
  2. 如何获取访问 token 和访问 secret token (在 Mozilla 上)?
  3. 是否有任何逐步测试任何 REST API 的教程?

最佳答案

0) 安装 https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo到你的 chrome

1) 使用命令获取 oAuth 客户端工具:

sudo gem install oauth

2) 设置 Magento 服务器

3) 获取 oAuth token

oauth \
--verbose \
--query-string \
--consumer-key v484mnii2jyswedm6uo2cfcjay7uy49snws \
--consumer-secret koay6845che7giy5lr17gnrhckkbhf8h5 \
--access-token-url http://www.yourstore.com/magento/oauth/token \
--authorize-url http://www.yourstore.com/magento/oauth/authorize \
--request-token-url http://www.yourstore.com/magento/oauth/initiate \
authorize

回应:

Server appears to support OAuth 1.0a; enabling support.
Please visit this url to authorize:
http://www.yourstore.com/magento/oauth/authorize?oauth_token=ey6fokp0pbzwr1016eb528y5xw1ak5ji

Please enter the verification code provided by the SP (oauth_verifier):
YOUR_CODE_HERE

Response:
oauth_token_secret: g9kyz8c7zv868d58eav1muih3gxvq763
oauth_token: aqvlfv9tuexn0mqiydgkaff4ixxg8743c

4) 调用 API

oauth \
--consumer-key v484mnii2jyswedm6uo2cfcjay7uy49snws \
--consumer-secret koay6845che7giy5lr17gnrhckkbhf8h5 \
--token aqvlfv9tuexn0mqiydgkaff4ixxg8743c \
--secret g9kyz8c7zv868d58eav1muih3gxvq763 \
--uri http://www.yourstore.com/magento/api/rest/products \
debug

试试 http://www.yourstore.com/magento/api/rest/products


找到解决方案

http://www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/

对于 php

https://gist.github.com/2469319

关于php - 如何从 Magento 1.7 REST API 获取访问 token 和访问 token secret ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13263343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com