SleekXMPP icon indicating copy to clipboard operation
SleekXMPP copied to clipboard

Add X-HIPCHAT-OAUTH2 SASL mechanism

Open SamWhited opened this issue 9 years ago • 4 comments

A SASL mechanism for authenticating to HipChat with an OAUTH2 token as documented here.

SamWhited avatar Sep 21 '15 22:09 SamWhited

It seems unlikely your commit is at fault, but maybe I've stumbled onto a sleekxmpp bug that reveals itself on a very busy server when we get presence info unexpectedly early?

JessicaMulein avatar Jan 27 '16 18:01 JessicaMulein

That sounds likely to me; if it's only showing up with HipChat auth it could be a race condition on our end or something (we might be sometimes sending presence info before the session is done being set up). I'll see what I can find.

SamWhited avatar Jan 27 '16 18:01 SamWhited

If it helps any, the session started handler hasn't yet fired at the point of error and I'll confirm again that the issue hasn't happened on any of the startups with plain auth, but has happened every time with the hipchat auth. If you want to know our group ID or my user id, I'll send that to you personally.

Also, the source I'm toying with is here: https://github.com/BrettTrotter/hipchat-aggregator-bot/blob/alertbot-oauth/alerts/init.py or the alertbot branch for plain auth. It's a really dumb bot that serves a specific purpose on our team, based off an older bot I wrote that aggregates streams from several channels down to one for easier monitoring.

I cheated a bit on getting the auth mechanism into the factory, but i think it works.

JessicaMulein avatar Jan 27 '16 19:01 JessicaMulein

As an experiment I connected to a different hipchat account on a company with only one other person. The last message I see is DEBUG SEND (IMMED): <stream:stream to='chat.hipchat.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'> and the thing never gets to session start. It sits there without disconnecting right away.. eventually it does this:

DEBUG    SEND (IMMED): <stream:stream to='chat.hipchat.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
DEBUG    Scheduled event: Session timeout check: ()
DEBUG    Session start has taken more than 45 seconds
DEBUG    Event triggered: session_end
DEBUG    SEND (IMMED): </stream:stream>
INFO     Waiting for </stream:stream> from server
DEBUG    RECV: <stream type="error" from="chat.hipchat.com" to="********@chat.hipchat.com/bot||proxy|pubproxy-d200.hipchat.com|5232">
WARNING  Legacy XMPP 0.9 protocol detected.

The HipChat server seems to be ignoring the stream start of our client or otherwise is in a bad state? This seems to jive with the presence messages being sent out of turn. Maybe it forgets a step in the process when it's doing HipChat Auth?

JessicaMulein avatar Jan 27 '16 19:01 JessicaMulein