Subject: X-FACEBOOK-PLATFORM authentication
Hello,
I have a problem with X-FACEBOOK-PLATFORM authentication mechanism. I tried to find solution on forum, but I found nothing. Everything works fine with DIGEST-MD5.
Here is my code.
his.xmppClient = new XmppClient()
{
Password = this.account.Password,
Username = this.account.Username,
XmppDomain = this.account.Domain,
Status = "Online",
Show = Show.chat,
Port = 5222,
StartTls = true,
Hostname = "chat.facebook.com",
};
// Event handlers for Matrix
this.xmppClient.OnBeforeSasl += this.xmppClient_OnBeforeSasl;
this.xmppClient.OnLogin += this.XmppClient_OnLogin;
this.xmppClient.OnAuthError += this.XmppClient_OnAuthError;
this.xmppClient.OnError += this.XmppClient_OnError;
this.xmppClient.OnRosterStart += this.XmppClient_OnRosterStart;
this.xmppClient.OnRosterItem += this.XmppClient_OnRosterItem;
this.xmppClient.OnRosterEnd += this.XmppClient_OnRosterEnd;
this.xmppClient.OnReceiveXml += this.XmppClient_OnReceiveXml;
this.xmppClient.OnSendXml += this.XmppClient_OnSendXml;
try
{
this.xmppClient.Open();
}
catch (Exception ex)
{
Console.WriteLine("During the open");
Console.WriteLine(ex.Message);
}
Thread.Sleep(500*60);
this.xmppClient.SendPresence(Show.chat, "Online");
// Get Online users
this.xmppClient.OnPresence += this.XmppClient_OnPresence;
this.xmppClient.AutoRoster = true;
public void xmppClient_OnBeforeSasl(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
{
Console.WriteLine("OnBeforeSasl");
e.Auto = false;
e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.X_FACEBOOK_PLATFORM;
e.SaslProperties = new Matrix.Xmpp.Sasl.Processor.Facebook.FacebookProperties
{
ApiKey = AppId,
ApiSecret = AppSecret,
AccessToken = this.accessToken
};
Console.WriteLine(e.SaslProperties);
}
And XML:
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.facebook.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="46E9AD61" from="chat.facebook.com" version="1.0" xmlns="jabber:client" xml:lang="en" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>X-FACEBOOK-PLATFORM</mechanism>
<mechanism>DIGEST-MD5</mechanism>
</mechanisms>
</stream:features>
SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
On TLS state = Matrix.EventArgs
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.facebook.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="29C60E1A" from="chat.facebook.com" version="1.0" xmlns="jabber:client" lang="en" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>X-FACEBOOK-PLATFORM</mechanism>
<mechanism>DIGEST-MD5</mechanism>
</mechanisms>
</stream:features>
SEND: <auth mechanism="X-FACEBOOK-PLATFORM" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dmVyc2lvbj0xJm1ldGhvZD1hdXRoLnhtcHBfbG9naW4mbm9uY2U9RDJGRjU2MzZCNkQ3NjFEMjQyNDRFNDMwQzI3RENDRjE=</challenge>
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">bWV0aG9kPWF1dGgueG1wcF9sb2dpbiZhcGlfa2V5PTM2NjA2MTc3MDA5ODk1NSZhY2Nlc3NfdG
9rZW49QUFBRk03bVhGeVFzQkFHVWhPRnRKem96QTNJaFFMc2tBYlJDYUtRSVYxdGlDWkNtY2I5ZW9POFFaQXdFd21TY3ZtbmFWaFJtc0s3czlHbDh6NXpvRHpEeHh5RUFjckFMaTNFU3dTcXpRWkRaRCZ2PTEuMCZjYWxsX2lkPTQ4NTgwOTU5OSZub25jZT1EMkZGNTYzNkI2RDc2MUQyNDI0NEU0MzBDMjdEQ0NGMQ==</response>
RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<not-authorized />
</failure>
OnAuthError!
SEND: </stream:stream>
RECV: </stream:stream>
Thank you! Raman
I have a problem with X-FACEBOOK-PLATFORM authentication mechanism. I tried to find solution on forum, but I found nothing. Everything works fine with DIGEST-MD5.
Here is my code.
his.xmppClient = new XmppClient()
{
Password = this.account.Password,
Username = this.account.Username,
XmppDomain = this.account.Domain,
Status = "Online",
Show = Show.chat,
Port = 5222,
StartTls = true,
Hostname = "chat.facebook.com",
};
// Event handlers for Matrix
this.xmppClient.OnBeforeSasl += this.xmppClient_OnBeforeSasl;
this.xmppClient.OnLogin += this.XmppClient_OnLogin;
this.xmppClient.OnAuthError += this.XmppClient_OnAuthError;
this.xmppClient.OnError += this.XmppClient_OnError;
this.xmppClient.OnRosterStart += this.XmppClient_OnRosterStart;
this.xmppClient.OnRosterItem += this.XmppClient_OnRosterItem;
this.xmppClient.OnRosterEnd += this.XmppClient_OnRosterEnd;
this.xmppClient.OnReceiveXml += this.XmppClient_OnReceiveXml;
this.xmppClient.OnSendXml += this.XmppClient_OnSendXml;
try
{
this.xmppClient.Open();
}
catch (Exception ex)
{
Console.WriteLine("During the open");
Console.WriteLine(ex.Message);
}
Thread.Sleep(500*60);
this.xmppClient.SendPresence(Show.chat, "Online");
// Get Online users
this.xmppClient.OnPresence += this.XmppClient_OnPresence;
this.xmppClient.AutoRoster = true;
public void xmppClient_OnBeforeSasl(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
{
Console.WriteLine("OnBeforeSasl");
e.Auto = false;
e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.X_FACEBOOK_PLATFORM;
e.SaslProperties = new Matrix.Xmpp.Sasl.Processor.Facebook.FacebookProperties
{
ApiKey = AppId,
ApiSecret = AppSecret,
AccessToken = this.accessToken
};
Console.WriteLine(e.SaslProperties);
}
And XML:
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.facebook.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="46E9AD61" from="chat.facebook.com" version="1.0" xmlns="jabber:client" xml:lang="en" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>X-FACEBOOK-PLATFORM</mechanism>
<mechanism>DIGEST-MD5</mechanism>
</mechanisms>
</stream:features>
SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
On TLS state = Matrix.EventArgs
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="chat.facebook.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="29C60E1A" from="chat.facebook.com" version="1.0" xmlns="jabber:client" lang="en" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>X-FACEBOOK-PLATFORM</mechanism>
<mechanism>DIGEST-MD5</mechanism>
</mechanisms>
</stream:features>
SEND: <auth mechanism="X-FACEBOOK-PLATFORM" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dmVyc2lvbj0xJm1ldGhvZD1hdXRoLnhtcHBfbG9naW4mbm9uY2U9RDJGRjU2MzZCNkQ3NjFEMjQyNDRFNDMwQzI3RENDRjE=</challenge>
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">bWV0aG9kPWF1dGgueG1wcF9sb2dpbiZhcGlfa2V5PTM2NjA2MTc3MDA5ODk1NSZhY2Nlc3NfdG
9rZW49QUFBRk03bVhGeVFzQkFHVWhPRnRKem96QTNJaFFMc2tBYlJDYUtRSVYxdGlDWkNtY2I5ZW9POFFaQXdFd21TY3ZtbmFWaFJtc0s3czlHbDh6NXpvRHpEeHh5RUFjckFMaTNFU3dTcXpRWkRaRCZ2PTEuMCZjYWxsX2lkPTQ4NTgwOTU5OSZub25jZT1EMkZGNTYzNkI2RDc2MUQyNDI0NEU0MzBDMjdEQ0NGMQ==</response>
RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<not-authorized />
</failure>
OnAuthError!
SEND: </stream:stream>
RECV: </stream:stream>
Thank you! Raman