blynk-library-python icon indicating copy to clipboard operation
blynk-library-python copied to clipboard

Invalid Token RPi4b

Open domcio01 opened this issue 4 years ago • 8 comments

Hi i have problem with connecting my raspi with blynk.cloud via python3 i get invalid token information all the time. For now im only trying to connect and see if device is online.

blynk1

import BlynkLib
BLYNK_AUTH = 'CEliuHR*************1AafR9G9__k'
blynk = BlynkLib.Blynk(BLYNK_AUTH, server='blynk-cloud.com', port=8080)

while True:
    blynk.run()

and i got blynk2

what i did :

pip install blynk-library-python

i also cloned this git and run

sudo python3 setup.py

i also tried to install other python blynk libraries from git but i have the same problem

domcio01 avatar Jan 19 '22 18:01 domcio01

Why are you connecting to port 8080? This works for me on an ESP: https://community.blynk.cc/t/device-offline-micropython-new-blynk/58432/32?u=emilio and have you seen this? https://github.com/vshymanskyy/blynk-library-python/blob/master/examples/Edgent_Linux_RPi/main.py

ebolisa avatar Jan 20 '22 12:01 ebolisa

Hi i have problem with connecting my raspi with blynk.cloud via python3 i get invalid token information all the time. For now im only trying to connect and see if device is online.

blynk1

import BlynkLib
BLYNK_AUTH = 'CEliuHR*************1AafR9G9__k'
blynk = BlynkLib.Blynk(BLYNK_AUTH, server='blynk-cloud.com', port=8080)

while True:
    blynk.run()

and i got blynk2

what i did :

pip install blynk-library-python

i also cloned this git and run

sudo python3 setup.py

i also tried to install other python blynk libraries from git but i have the same problem

Also, your're using an older lib version.

ebolisa avatar Jan 20 '22 15:01 ebolisa

@ebolisa what i new version of lib 1.0.0? thanks that worked for ver 0.2.0 but not for 1.0.0

import BlynkLib
BLYNK_AUTH="token"
try:
#         blynk = BlynkLib.Blynk(BLYNK_AUTH, insecure=True)
        blynk = BlynkLib.Blynk(BLYNK_AUTH,
#        insecure=True,          # disable SSL/TLS
        server='blynk.cloud', # fra1.blynk.cloud or blynk.cloud
        port=80,                # set server port
        heartbeat=30,           # set heartbeat to 30 secs
        log=print              # use print function for debug logging
        )
except OSError as e:
    utime.sleep(3)
    restart_and_reconnect(e)
while True:
   blynk.run()

domcio01 avatar Jan 21 '22 22:01 domcio01

Hello I have the same problem on a Pi Zero. I just copied the example

Invalied auth token

ragasjohn avatar Mar 12 '22 17:03 ragasjohn

Same thing here: "Invalid auth token".

pi@raspberrypi:~/bin/doorbell $ pip3 list | grep -i blynk
blynk-library-python             0.2.0

My script test file:

import BlynkLib

BLYNK_AUTH = "oC############################aN"  # OMITTED FOR GITHUB

# initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

@blynk.VIRTUAL_WRITE("V0")
def v0_write_handler(value):
    print('Current v0 value: {}'.format(value))

while True:
    blynk.run()

Double checked and the auth tokin is identical to the device's info.

pi@raspberrypi:~/bin/doorbell $ python3 blynk_og.py

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ for Python v0.2.0 (Linux)

Invalid auth token

dulinux avatar Apr 01 '22 01:04 dulinux

Try to use your local server (shown at the bottom rt in your dashboard) and not blynk.cloud. Also try the example shown above.

ebolisa avatar Apr 01 '22 05:04 ebolisa

My script test file:

blynk = BlynkLib.Blynk(BLYNK_AUTH)

Solved by manually specifying the server with:

 blynk = BlynkLib.Blynk(BLYNK_AUTH, server="blynk.cloud")

dulinux avatar Apr 02 '22 00:04 dulinux

If you use a closer server to you, the connection will be a bit faster. In EU it’s fra1.blynk.com As shown in the test code above.

ebolisa avatar Apr 02 '22 08:04 ebolisa