zello-channel-api icon indicating copy to clipboard operation
zello-channel-api copied to clipboard

Missing refresh_token in successful authentication call - Consumer API

Open HotEmu opened this issue 2 years ago • 9 comments

Upon sending the following message via websockets, with either developer JWT token, or production JWT token generated with private keys.

{ seq: 1, command: "logon", auth_token: 'token', username: 'username', password: 'password', channel: 'channel', listen_only: true }

The response is missing a refresh token:

{"success":true,"seq":1}

The outcome:

Upon dropped connection (which happens consistently between 1 to 10 seconds), I'm unable to reconnect to Zello. There are no errors.

So, where is the refresh token? And if it's no longer provided--how am I supposed to reconnect to Zello? At this point, I have to kill the app to clear the websockets to connect--which doesn't matter much because the connection drops all the time anyway after sending a few audio messages.

HotEmu avatar Dec 22 '21 03:12 HotEmu

Hi @HotEmu,

Are you using Zello Consumer or Zello Work?

So far, I noticed a property listen_only In your logon packet, so you should get an error listen only connection in response on the start_stream command, so I wonder if you successfully sent an audio message to the channel.

ihorserba avatar Dec 22 '21 12:12 ihorserba

Thank you for the reply @ihorserba I'm flagging listen_only because at this point I just want to listen to messages from a channel.

I'm using the consumer account for this.

I've been playing with configs and noticed a forked repo where someone just commented out a check for refresh_token. After all I'm also getting "success" response, just no token.

What's confusing is that once a connection drops (it looks like it drops within 1 to 10 seconds if there are no messages to listen to). Ping/ponging the server doesn't help. I thought it was the token problem but looks like a different problem. I have to completely end the process for the websocket to cconnect again.

HotEmu avatar Dec 22 '21 13:12 HotEmu

Actually I'll correct what I said. Upon a dropped connection to wss://zello.io/ws the connection closes (websocket gets "close" event). I then attempt to reconnect (tried with time out and without). I send the "logon" packet again (with all the credentials and the auth token (tried dev token and production generated token)). The connection is established, I get "open" event from websocket, but upon sending the "logon" packet as described above...nothing happens, no error, no response, as if Zello was ignoring it. I then have to kill the app and try again. I tried ws.terminate(), I tried completely clearing the websocket.

HotEmu avatar Dec 22 '21 13:12 HotEmu

Hi all.

I haven't checked my ts-zello library for some time, and now discovered that it's stopped working. So I compared docs changes to reveal that some things have really changed. I congratulate you guys with this progress.

For those interested what has changed: https://github.com/zelloptt/zello-channel-api/compare/fa3d161d8257a050af5aac6d6604e1a986e72dbc...b614301466e4ee625312a6f4a485dd15a09b143d

I confirm that server responds without refresh_token defined. So it's definitely a bug, either in API or in the docs.

So what is the correct behavior now?

@ihorserba, folks?

OnkelTem avatar Jan 26 '22 23:01 OnkelTem

I'm experiencing exactly the same problem. No refresh token is received and audio stream drops with 1 to 10 seconds.

philliperosario avatar Mar 24 '22 09:03 philliperosario

audio stream drops with 1 to 10 seconds.

If you experience this please double check that you've implemented WebSocket connection keep-alive. If you still experience the issue please include a minimal code example that allows to recreate it.

agatx avatar Mar 24 '22 20:03 agatx

audio stream drops with 1 to 10 seconds.

If you experience this please double check that you've implemented WebSocket connection keep-alive. If you still experience the issue please include a minimal code example that allows to recreate it.

ws.send(JSON.stringify({ command: "logon", auth_token: token, username: username, password: password, channel: channel, }));

The response is missing a refresh token:

{"success":true,"seq":1}

And only the Sample Developer Token is accepted on auth_token.

It is interesting to note that the code works normally on the first execution of the day. Every other time the final part of the audio is cut off.

philliperosario avatar Mar 25 '22 12:03 philliperosario

We have found the root cause and fixed it. A refresh_token is sent in response to the successful logon command.

ihorserba avatar May 06 '22 17:05 ihorserba

Great. Thank you.

Em sex., 6 de mai. de 2022 14:54, Ihor @.***> escreveu:

We have found the root cause and fixed it. A refresh_token is sent in response to the successful logon command.

— Reply to this email directly, view it on GitHub https://github.com/zelloptt/zello-channel-api/issues/162#issuecomment-1119854502, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEBZDJVKMORA4DB7U2WJLTVIVMEVANCNFSM5KRSRTWQ . You are receiving this because you commented.Message ID: @.***>

philliperosario avatar May 06 '22 22:05 philliperosario