Jwt parse error: token contains an invalid number of segments


#1

Hello,

I have tried to solve this problem that i have but I didn’t achieved it, then I open this question.

First I have tried setting into lora-gateway-config and loraserver files variable GW_SERVER_JWT_SECRET using ‘openssl rand -base64 32’, when the loraserver is running i don’t have errors but when I watch the lora-gateway-config journal i have a error for a “jwt parse error”

sudo journalctl -u lora-gateway-config -f -n 50

Aug 23 08:42:51 beaglebone systemd[1]: Started LoRa Gateway Config.
Aug 23 08:42:51 beaglebone lora-gateway-config[11807]: time=“2017-08-23T08:42:51-05:00” level=info msg=“starting LoRa Gateway Config” base_config_file="/opt/semtech/packet_forwarder/lora_pkt_fwd/" docs=“https://docs.loraserver.io/” output_config_file="/opt/semtech/packet_forwarder/lora_pkt_fwd/" version=0.1.0
Aug 23 08:42:51 beaglebone lora-gateway-config[11807]: time=“2017-08-23T08:42:51-05:00” level=info msg=“connecting to gateway-server” ca-cert= server=“0.0.0.0:8002” tls-cert= tls-key=
Aug 23 08:42:51 beaglebone lora-gateway-config[11807]: time=“2017-08-23T08:42:51-05:00” level=info msg="checking for updated configuration"
Aug 23 08:42:51 beaglebone lora-gateway-config[11807]: time=“2017-08-23T08:42:51-05:00” level=error msg="update config error: get packet-forwarder config error: get configuration error: rpc error: code = Unauthenticated desc = authentication failed: jwt parse error: token contains an invalid number of segments"
Aug 23 08:42:51 beaglebone lora-gateway-config[11807]: time=“2017-08-23T08:42:51-05:00” level=info msg=“sleeping until next update check” duration=5m0s
Aug 23 08:47:51 beaglebone lora-gateway-config[11807]: time=“2017-08-23T08:47:51-05:00” level=info msg="checking for updated configuration"
Aug 23 08:47:52 beaglebone lora-gateway-config[11807]: time=“2017-08-23T08:47:51-05:00” level=error msg=“update config error: get packet-forwarder config error: get configuration error: rpc error: code = Unauthenticated desc = authentication failed: jwt parse error: token contains an invalid number of segments”

sudo journalctl -u loraserver -f -n 50

Aug 22 17:51:04 beaglebone systemd[1]: Started LoRa Server.
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“starting LoRa Server” band=“EU_863_870” docs=“https://docs.loraserver.io/” net_id=010203 version=0.20.1
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“setup redis connection pool” url="redis://localhost:6379"
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg="connecting to postgresql"
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“backend/gateway: connecting to mqtt broker” server="tcp://localhost:8883"
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“connecting to application-server” ca-cert= server=“127.0.0.1:8001” tls-cert= tls-key=
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg="no network-controller configured"
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“migrated node-sessions to new format” errors=0 migrated=0
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg="applying database migrations"
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“migrations applied” count=0
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“starting api server” bind=“0.0.0.0:8000” ca-cert= tls-cert= tls-key=
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“starting gateway api server” bind=“0.0.0.0:8002” ca-cert= tls-cert= tls-key=
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg="backend/gateway: connected to mqtt server"
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“backend/gateway: subscribing to rx topic” topic="gateway/+/rx"
Aug 22 17:51:05 beaglebone loraserver[3451]: time=“2017-08-22T17:51:05-05:00” level=info msg=“backend/gateway: subscribing to stats topic” topic=“gateway/+/stats”

I found some replies for this error in github

and also I have tried using https://jwt.io/ and https://pyjwt.readthedocs.io/en/latest/ but I still have the error

Someone could give me support for this error


#2

Did you set the --gw-client-jwt-token / GW_CLIENT_JWT_TOKEN? You should first create the gateway in LoRa App Server. From there you are able to retrieve this token.