如何在Ruby中验证oauth、Magento 2.0 SOAP
使用oauth凭据对Magento 2 SOAP进行身份验证时出现问题 对于magento 1.9版本,这非常简单:如何在Ruby中验证oauth、Magento 2.0 SOAP,ruby,magento2,savon,Ruby,Magento2,Savon,使用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"
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 soap集成,并给我一些建议 您需要从管理员创建一个新的集成来获取身份验证密钥。这些链接将是有用的资源:
是的,我很清楚。实际上,对于那些寻找这种流(并且不想使用Desive)的人来说,这是一个有效的例子。我的问题是,如何将它与Savon(soap gem和Magento 2.0)一起使用。