pascal - 如何在 Pascal 中创建 QuickBlox session

标签 pascal quickblox

我在 Pascal 上创建 QuickBlox session 时遇到问题。

这里没有找到任何示例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 
   + '&timestamp=' + 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 - 如何在 Pascal 中创建 QuickBlox session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30477351/

相关文章:

C语言。不使用空终止的字符串长度

installation - InnoSetup : Generate Icons in Common/User Desktop based on values inside Installer

javascript - Quickblox 对话框 - 用户无法恢复

android - 在 Android 上使用 XMPP 实现聊天应用程序的更好方法?

delphi - Delphi 有没有好的类似 Pascal 的脚本语言?

enums - pascal 中 'read' 枚举类型的任何简单方法?

delphi - 为什么 I/O 错误无法引发异常?

ios - Quickblox iOS - 请求对象,按 'Created At' 排序

iphone - 在 QuickBlox 上创建位置

java - 从 Android 向 QuickBlox 用户注册用户