ruby - 如何在 Ruby 中验证 oauth、Magento 2.0 SOAP
问题描述
使用 oauth 凭据对 Magento 2 SOAP 进行身份验证时出现问题。
对于 magento 1.9 版本,这非常简单:
client = Savon.client(
wsdl: "https://example.com/api/soap/?wsdl=1",
log: true,
pretty_print_xml: true
)
session_id = client.call(:login, message: { username: "username", apiKey: "key" })body[:login_response][:login_return]
client.call(:call, message:{resource_path: 'catalog_product.list', session_id: session_id}).body
按预期工作。使用 oauth 会变得更复杂一些。我尝试了各种不同的东西,比如:
client = Savon.client(
wsdl: "http://example.com/index.php/soap/default?wsdl_list=1",
soap_header: { 'Authorization:' => "Basic xxxx"},
pretty_print_xml: true
)
client.call(:call, message:{resource_path: 'catalogProductAttributeGroupRepositoryV1'}).body
希望有人已经进行了 oauth-magento 2 肥皂集成并给我一些指示。
解决方案
推荐阅读
- excel - 根据复选框复制单元格值并导出为word
- google-sheets - 如果...“或”对于 Google 表格中的数组公式更有效?
- mapbox - Mapbox 以编程方式添加不同高度的多边形
- flutter - 如何通过变量引用实例化一个类?
- python - 尝试安装我的 android 应用程序时收到错误消息
- substrate - 您如何接受带有墨水的文件?
- javascript - 使用 setInterval 时无法将事件添加到 DataTable 分页按钮
- r - 将复杂数据重塑为宽格式,其中输入是长数据和宽数据的混合
- python - 尝试导入繁重的 python 文件时系统停止响应
- javascript - Tone.js 应用程序 - 直到第二次点击音频才会开始