相关疑难解决方法(0)

整合Facebook聊天

我已经编写了一个程序来集成在C#中的Facebook用户聊天,但是我总是<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>在将响应发送到服务器之后得到.

我检查了API密钥和App秘密,两者都是正确的.看起来我将一些错误的参数传递给服务器.

这是我的代码.

private void GetDetailsButton_Click(object sender, EventArgs e)
{
     TcpClient FacebookClient = new TcpClient();
     FacebookClient.Connect("chat.facebook.com", 5222);
     NetworkStream myns = FacebookClient.GetStream();

     string xml = "<?xml version='1.0'?>" +
     "<stream:stream " +
     "id='1' " +
     "to='chat.facebook.com' " +
     "xmlns='jabber:client' " +
     "xmlns:stream='http://etherx.jabber.org/streams' " +
     "version='1.0' >";

     StreamWriter mySw = new StreamWriter(myns);
     mySw.WriteLine(xml);  //sending initial request
     mySw.Flush();

     byte[] serverResponseByte = new byte[1024];
     int myBytesRead = 0;
     StringBuilder myResponseAsSB = new StringBuilder();

     //reading response from the server to see the supported …
Run Code Online (Sandbox Code Playgroud)

c# facebook xmpp x-facebook-platform

16
推荐指数
3
解决办法
6810
查看次数

标签 统计

c# ×1

facebook ×1

x-facebook-platform ×1

xmpp ×1