blynkkk / lib-python

Blynk IoT library for Python and Micropython
MIT License
237 stars 83 forks source link

Cannot authenticate to server and test fail #47

Closed devguyplus closed 3 years ago

devguyplus commented 3 years ago

Hi, Im trying to setup blynk and start using the platform. Unfortunately I have faced a number of issues.

I started by installing the library and running it on my PC (not embedded device) Running python setup.py test fails on a test:

E       assert 1 == 0
E         +1
E         -0

test\test_blynk_protocol.py:26: AssertionError

And when I run the library with the following code:

import blynklib
BLYNK_AUTH = 'vXFXq8rp0y10GtYUl9bL2J_c81AFTVyz'
print("Connecting to Blynk server...")
blynk = blynklib.Blynk(BLYNK_AUTH)
print("connecting to server...")
blynk.connect()
print("ststus: {}".format(str(blynk.connected())))
print("starting up server")
while True:
    blynk.run()

It returns: [ERROR]: Invalid Auth Token I have manually modified the server from blynk-cloud.com to blynk.cloud and then it returns: Authenticating device... [ERROR]: Auth stage failed. Status=4

Would appreciate your help :)

alexmaurer-madis commented 3 years ago

Exactly the same here with the server DNS blynk.cloud.

blynklib.BlynkError: Auth stage failed. Status=4

antohaUa commented 3 years ago

Hi alexmaurer-madis ! Auth token mentioned by you looks strange

import blynklib
BLYNK_AUTH = 'vXFXq8rp0y10GtYUl9bL2J_c81AFTVyz'
print("Connecting to Blynk server...")

Real token should look like this ( only [0-9a-f] {32 }characters) BLYNK_AUTH = '9428d7f3d17d4910b9d6da26f853a5dc'

Please check token that you got from blynk-cloud.com registartion

antohaUa commented 3 years ago

Btw thanks for mentioned failed unit test - now it is fixed

======= 73 passed in 0.21s =====

devguyplus commented 3 years ago

Screenshot 2021-09-15 142820 This is the auth token that I have received.

antohaUa commented 3 years ago

As I know week ago authentication changed and blynk uses another cloud and platform. Previous cloud also work but not sure if new users allowed to do sign up there Will try to ask blynk team for help. @blynkkk can you give some advise for @devguyplus

ondrej1024 commented 3 years ago

I think this library needs to be updated to be compatible with the new Blynk 2.0 platform. I see this has been done in blynk-library-python

devguyplus commented 3 years ago

I think this library needs to be updated to be compatible with the new Blynk 2.0 platform. I see this has been done in blynk-library-python

That did work, thanks alot!

ondrej1024 commented 3 years ago

That did work, thanks alot!

Could you please post a simple example code how you made this work? Thanks

devguyplus commented 3 years ago

That did work, thanks alot!

Could you please post a simple example code how you made this work? Thanks

I just used the library you mentioned (blynk-library-python) instead of lib-python and it connected to the blynk server and received events.

ondrej1024 commented 3 years ago

OK, interesting. From reading the docs it looked like initialization of the new lib is different from the old one.