Search code examples
pythonwhatsappyowsup

Yowsup Authentication don't work


I'm trying to make some test with this nice library.

I have made successfully tests with yowsup-cli but now I'd like to create a small python script to manage in a smart ways events (with listener/callback).

I'm trying the code explained here https://github.com/tgalal/yowsup/wiki/Yowsup-Library-Documentation:

def onAuthSuccess(username):
print "Logged in with %s" % s
# make a call to method ready to be able to receive messages
methodsInterface.call("ready")


y = YowsupConnectionManager()
signalsInterface = y.getSignalsInterface()
methodsInterface = y.getMethodsInterface()
signalsInterface.registerListener("auth_success", onAuthSuccess)
methodsInterface.call("auth_login", ("username", "password"))

Is clear that username should be nationNumber + phoneNumber without other symbols. But is not clear to me where the password should be found. With cli the authentication mechanism is different and it need a registration.

Can you help me please? Thanks


Solution

  • Just incase someone has the same problem that authentication isn't working though you're passing the right username and password as argument, You have to base 64 encode the password like is done in the Command Line client.

    You have to get the password by registering using Yowsup or WART OR from your phone ( https://github.com/tgalal/yowsup/issues/234 ? )

     import base 64
     password= 'randomletters+somenumbers=' #Get this by registering
     password = base64.b64decode(bytes(rawPass.encode('utf-8'))) 
    

    This is not obvious and i forget often and might be what's going wrong.