Closed alexander-akhmetov closed 11 years ago
Here's how to create a new SASL mechanism, based on the docs you linked:
from sleekxmpp.util.sasl import sasl_mech, Mech
@sasl_mech(3)
class X_YANDEX_OAUTH(Mech):
name = 'X-YANDEX-OAUTH'
required_credentials = set(['username', 'access_token'])
def process(self, challenge=b''):
user = self.credentials['username']
token = self.credentials['access_token']
return user + b'\x00' + token
Just be sure to import that before starting your ClientXMPP instance.
You'll also need to save your OAuth token in: your_client.credentials['access_token']
Thanks a lot, it works!
Hi, I am using SleexXMPP version 1.1.11. I'm trying to login to the server push.xmpp.yandex.ru ( http://api.yandex.com/disk/doc/dg/concepts/xmpp_xmpp-connection.xml ):
The server supports only one type of authentication - X-YANDEX-OAUTH. I tried to do this by passing a parameter sasl_mech='X-YANDEX-OAUTH' in the constructor ClientXMPP, but it's not work. Can somebody tell how to use a custom authentication type?
I'm new to Python and XMPP, and sorry for my bad English :)