Tools
Tools copied to clipboard
issue with RTC token on the web
hello everyone!
I'm having a problem trying to connect to an Agora video channel.
I use generated token from backend and it works on android but not on web. (generated token from console works well)
on test site https://webdemo.agora.io/basicVoiceCall/index.html throws an error "AgoraRTCError CAN_NOT_GET_GATEWAY_SERVER: invalid token, authorized failed"
here is an example of a token and a channel:
token: 007eJxTYHg6ddKCkLSXkvpvT+fPF9up9OQGs8gq2b1py7Je9q99dXqnAkNiikWqUVqaZWpiarJJWmKaZZJpokmiUYqFsXFiomWi6Yo4hpSGQEYG7olXmBkZGBlYgBjEZwKTzGCSBUyyMxQaJh= channel: pleeels
could you suggest what could be the problem?
which uid did you set when you generate the token?
i set 0 (zero)
could you pls share your appid and generate a token which expires after 24 hours, so that i can try it out from my end?
Yep appId: ad8e2ff9eaec4faf9b5a4a2d833aa9a5 token: 007eJxTYPA2kTHZvcKX99eVtfckdt//lBxUzqWVECt7qs9tVri/6gEFhsQUi1SjtDTL1MTUZJO0xDTLJNNEk0SjFAtj48REy0TT2jyBlIZARgbhZAEmRgZGBhYgBvGZwCQzmGQBk+wMBTmpqak5xYwMBgDI/SIN
@klestovVlad which channel are you generating with? btw this token also works on your android?
@plutoless i genenrating with channel: pleeels and its work well on android
@klestovVlad i'm not seeing any success channel join with this channel name in our backend, how do you know that you have successfully joined the channel? btw maybe you can also share the code you used to generate token.
@plutoless We use PHP library for token generation, code is
$token = RtcTokenBuilder2::buildTokenWithUid($appID, $appCertificate, $channel, 0, RtcTokenBuilder2::ROLE_PUBLISHER, $expireTimeInSeconds, $expireTimeInSeconds);
it seems that for the web you need to send the uid from the server along with the token and use it to connect. But this scheme does not work for android. For android it ionly works when uid is set to zero
@klestovVlad For android it ionly works when uid is set to zero -> this uid refers to the one you used to generate token or the one you used to join channel?