c++ - Facebook chat XMPP authentication with Gloox? -
well, i'm doing silly, i've been beating head against wall past few hours, , far have no idea i've been doing wrong.
at moment i'm trying make work plain sasl because seems facebook actively makes oauth2 pain non-web apps, makes no difference me long can work somehow.
current code:
_client = new client(jid(username /* no @chat.facebook.com */), password); _client->setserver("chat.facebook.com"); _client->setport(5222); _client->setsaslmechanisms(gloox::saslmechplain); _client->settls(gloox::tlspolicy::tlsrequired); _client->connect(false); _client->login(); // not necessary? qthread::sleep(10); // arbitrary sleep; should sufficient std::cout << _client->authed() << std::endl; // false std::cout << _client->autherror() << std::endl; // autherrorundefined _client->rostermanager()->fill(); // neither 1 has effect messagesession(_client, jid("friend@chat.facebook.com")).send("balls"); messagesession(_client, jid("friend")).send("balls"); std::cout << _client->rostermanager()->roster()->size() << std::endl; // 0 edit: matter, can't gloox working gmail either (haven't tried other xmpp servers).
- your jid indeed
username@chat.facebook.com, notusername- , important sasl authentication, not work wrong jid. - facebook chat supports sasl plain authentication on ssl/tls connection, digest-md5
- google talk supports sasl plain on tls too
- you can see supported sasl mechanisms in first
<stream:features>...</stream:features>packet server - it better if show error logs
Comments
Post a Comment