Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Add X-HIPCHAT-OAUTH2 SASL mechanism #399

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

SamWhited
Copy link

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

@JessicaMulein
Copy link

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?

@SamWhited
Copy link
Author

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.

@JessicaMulein
Copy link

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
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants