如何在 Pascal 中创建 QuickBlox 会话
How to create a QuickBlox session in Pascal
我在 Pascal 上创建 QuickBlox 会话时遇到问题。
未在此处找到任何示例http://quickblox.com/developers/Authentication_and_Authorization#Examples
有人能帮帮我吗?
Pascal 的入门方法如下:
program qbsession;
uses fphttpclient,sysutils;
var
HTTP: TFPHTTPClient;
var
qbresponse: String;
const
applicationId: String = '92';
authKey: String = 'wJHdOcQSxXQGWx5';
authSecret: String = 'BTFsj7Rtt27DAmT';
var
randomValue: Integer;
timestamp: Int64;
body: String;
signature: String;
begin
Randomize;
randomValue := Random(5000);
timestamp := Trunc((Now - EncodeDate(1970, 1 ,1)) * 24 * 60 * 60);
HTTP := TFPHTTPClient.Create(nil);
// This is still to figure out how to do
// It should be some examples on Pascal how to do it
// http://quickblox.com/developers/Authentication_and_Authorization#Signature_generation
signature := '...';
body := 'application_id=' + applicationId + '&auth_key=' + authKey
+ '×tamp=' + IntToStr(timestamp) + '&nonce=' + IntToStr(randomValue)
+ '&signature=' + signature;
WriteLn('body: ' + body);
qbresponse := HTTP.FormPost('http://api.quickblox.com/session.json', body);
WriteLn('Response: ' + qbresponse);
HTTP.Free;
end.
我在 Pascal 上创建 QuickBlox 会话时遇到问题。
未在此处找到任何示例http://quickblox.com/developers/Authentication_and_Authorization#Examples
有人能帮帮我吗?
Pascal 的入门方法如下:
program qbsession;
uses fphttpclient,sysutils;
var
HTTP: TFPHTTPClient;
var
qbresponse: String;
const
applicationId: String = '92';
authKey: String = 'wJHdOcQSxXQGWx5';
authSecret: String = 'BTFsj7Rtt27DAmT';
var
randomValue: Integer;
timestamp: Int64;
body: String;
signature: String;
begin
Randomize;
randomValue := Random(5000);
timestamp := Trunc((Now - EncodeDate(1970, 1 ,1)) * 24 * 60 * 60);
HTTP := TFPHTTPClient.Create(nil);
// This is still to figure out how to do
// It should be some examples on Pascal how to do it
// http://quickblox.com/developers/Authentication_and_Authorization#Signature_generation
signature := '...';
body := 'application_id=' + applicationId + '&auth_key=' + authKey
+ '×tamp=' + IntToStr(timestamp) + '&nonce=' + IntToStr(randomValue)
+ '&signature=' + signature;
WriteLn('body: ' + body);
qbresponse := HTTP.FormPost('http://api.quickblox.com/session.json', body);
WriteLn('Response: ' + qbresponse);
HTTP.Free;
end.