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).

  1. your jid indeed username@chat.facebook.com, not username - , important sasl authentication, not work wrong jid.
  2. facebook chat supports sasl plain authentication on ssl/tls connection, digest-md5
  3. google talk supports sasl plain on tls too
  4. you can see supported sasl mechanisms in first <stream:features>...</stream:features> packet server
  5. it better if show error logs

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -