...I'm using the code below but still getting an authentication failure
Uzak webserver kaynak /xmlrpc.php
için HTTP Temel kimlik doğrulaması kabul, ve daha da kabul ettiğini olduğundan iki kere kontrol edin @username
ve @password
.
Bu gibi temel Auth ile docs, bir RPC için XMLRPC incantation client.call("bwizzy")
üretecektir bir şey başına:
POST /xmlrpc.php HTTP/1.1
User-Agent: XMLRPC::Client (Ruby 1.9.1)
Content-Type: text/xml; charset=utf-8
Content-Length: 88
Connection: keep-alive
Authorization: Basic c3RhY2s6b3ZlcmZsb3c=
Accept: */*
Host: localhost
<?xml version="1.0"><methodCall><methodName>bwizzy</methodName></params></methodCall>
(Bu başlıklardan sipariş hakkında bana şikayet etmeyin - ben tel üzerinde görmek ne :)!)
Şimdi, XML-RPC kendisi kimlik doğrulaması için sağlamaz, bu yüzden birkaç genel seçeneğiniz var:
Use typical "web auth" techniques
HTTP Authorization schemes, like you are currently using. Trusted client-side certs. Cookie authentication tokens. Etc.
Typical web auth techniques carry common risks, however. Poke around SO for more guidance here.
Extend the RPC functions to support user-defined auth
For example, the RPC call bwizzy
might take a username and password as arguments.
Or a login RPC function might generate a time-limited token to be used as a Cookie.
This approach is invasive -- now your RPC calls have to be auth-aware -- and error-prone -- now you have to implement auth yourself.
Extend XML-RPC itself
The XML RPC calls could be themselves signed or signed and encrypted, for example, ala SOAP's digital signatures