Hello all im trying to send rest api Users.getLoggedInUser i have all the secret session and all the Authenticationi made according to this site : http://wiki.developers.facebook.com/index.php/Authorization_and_Authentication_for_Desktop_Applications here is my code (cpp QT but it can be any thing else ) :
QString toAPISignature =
"api_key="
+ API_KEY
+ "call_id=" + strCallid
+ "format=XML"
+ "method=Users.getLoggedInUser"
+ "session_key="+ fbSessionKey
+ "v=1.0"+m_fbSecretKey;
QByteArray hashedApiData= QCryptographicHash::hash(toAPISignature.toAscii(),
QCryptographicHash::Md5);
QString APIMD5Signature(hashedApiData);
.....
.....
.....
// now set the api request
QUrl api_url;
api_url.setUrl(FB_REST_URL);
api_url.addQueryItem("api_key",API_KEY);
api_url.addQueryItem("session_key",fbSessionKey);
api_url.addQueryItem("call_id",strCallid);
api_url.addQueryItem("sig",APIMD5Signature);
api_url.addQueryItem("format","XML");
api_url.addQueryItem("method","Users.getLoggedInUser");
api_url.addQueryItem("v","1.0");
then i init the request object :
QNetworkRequest request;
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
request.setRawHeader("User-Agent", "Facebook API Client 0.1");
request.setUrl(url);
do the get request :
QEventLoop loop;
QNetworkReply *reply = networkManager->get(request);
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
QByteArray data=reply->readAll();
and this is the xml im getting back: look ..why the sig looks like this ? does the hash MD5 suppose to look like set of numbers ?
<arg>
<key>sig</key>
<value>N{?¬???¬@?±B???????¶</value>
</arg>
<?xml version="1.0" encoding="UTF-8"?>
<error_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
<error_code>104</error_code>
<error_msg>Incorrect signature</error_msg>
<request_args list="true">
<arg>
<key>api_key</key>
<value>bc5xxxxxxxxx57811</value>
</arg>
<arg>
<key>session_key</key>
<value>a99fdxxxxxxx5c2-100xxxxx455</value>
</arg>
<arg>
<key>call_id</key>
<value>1</value>
</arg>
<arg>
<key>sig</key>
<value>N{?¬???¬@?±B???????¶</value>
</arg>
<arg>
<key>format</key>
<value>XML</value>
</arg>
<arg>
<key>method</key>
<value>Users.getLoggedInUser</value>
</arg>
<arg>
<key>v</key>
<value>1.0</value>
</arg>
</request_args>
</error_response>