如何从Magento的1.7 REST API获得访问令牌和访问令牌密钥 [英] How to get Access Token and Access Token Secret from Magento 1.7 REST API
问题描述
我注册我的应用程序在我的Magento管理。
已经得到消费者密钥和机密。
但我没有运气来获得访问令牌和访问令牌的秘密。
它说
oauth_problem = parameter_absent&安培; oauth_parameters_absent = oauth_consumer_key
块引用>
我是总部设这个链接测试
<一个href=\"http://www.magentocommerce.com/api/rest/testing_rest_resources.html\">http://www.magentocommerce.com/api/rest/testing_rest_resources.html
什么,我需要知道答案是
- 我必须填写什么页眉和放大器;数据文本框?
- 如何获得访问令牌和访问令牌的秘密(Mozilla的)?
- 是否有任何教程一步一步地测试任何REST API?
解决方案0)安装<一href=\"https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo\">https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo在Chrome
1)获取与命令一个OAuth客户端工具:
sudo的创业板安装的OAuth
2)设置Magento的服务器
3)获取OAuth凭证
的OAuth \\
--verbose \\
--query串\\
--consumer键v484mnii2jyswedm6uo2cfcjay7uy49snws \\
--consumer秘密koay6845che7giy5lr17gnrhckkbhf8h5 \\
--access令牌-URL http://www.yourstore.com/magento/oauth/token \\
--authorize-URL http://www.yourstore.com/magento/oauth/authorize \\
--request令牌-URL http://www.yourstore.com/magento/oauth/initiate \\
授权回答:
服务器似乎支持OAuth的1.0A;使支持。
请访问这个网址授权:
http://www.yourstore.com/magento/oauth/authorize?oauth_token=ey6fokp0pbzwr1016eb528y5xw1ak5ji请输入由SP(oauth_verifier)中提供的验证code:
YOUR_ code_HERE响应:
oauth_token_secret:g9kyz8c7zv868d58eav1muih3gxvq763
组oauth_token:aqvlfv9tuexn0mqiydgkaff4ixxg8743c4)使API调用
的OAuth \\
--consumer键v484mnii2jyswedm6uo2cfcjay7uy49snws \\
--consumer秘密koay6845che7giy5lr17gnrhckkbhf8h5 \\
--token aqvlfv9tuexn0mqiydgkaff4ixxg8743c \\
--secret g9kyz8c7zv868d58eav1muih3gxvq763 \\
--uri http://www.yourstore.com/magento/api/rest/products \\
调试试
http://www.yourstore.com/magento/api/rest/products
发现它的解决方案
<一个href=\"http://www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/\">http://www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/
块引用>有关PHP
https://gist.github.com/2469319
块引用>I've registered my application on my magento admin.
already got the Consumer Key and Consumer Secret.
but i have no luck to get the access token and access token secret.
it said
oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key
i'm testing based on this link
http://www.magentocommerce.com/api/rest/testing_rest_resources.html
What i need to know the answer is
- What must i fill to Header & Data textfield?
- How to get the Access Token and Access Secret Token (on Mozilla)?
- Is there any tutorial step by step to test any REST API?
解决方案0) Install https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo to your chrome
1) Get an oAuth client tool with command :
sudo gem install oauth
2) Set up the Magento server
3) Get the oAuth tokens
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
RESPOND :
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) Make the API call
oauth \ --consumer-key v484mnii2jyswedm6uo2cfcjay7uy49snws \ --consumer-secret koay6845che7giy5lr17gnrhckkbhf8h5 \ --token aqvlfv9tuexn0mqiydgkaff4ixxg8743c \ --secret g9kyz8c7zv868d58eav1muih3gxvq763 \ --uri http://www.yourstore.com/magento/api/rest/products \ debug
try
http://www.yourstore.com/magento/api/rest/products
Found it the solution
http://www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/
for php
这篇关于如何从Magento的1.7 REST API获得访问令牌和访问令牌密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!