akshatvg / Agora-Invite-User-To-Stage

Invite a user to stage and become a host using a raise hand feature during a livestream using the @AgoraIO RTC and RTM SDKs.
https://handraise.akshatvg.com
MIT License
4 stars 0 forks source link

Login failed with args #1

Open aeq-dev opened 2 years ago

aeq-dev commented 2 years ago

Hello, Thank you for your great tutorials, I tried to apply this tutorial but I get this error : The vendor enabled the dynamic key, but uses the static key. +0ms Error Code 5: login failed with args: {"uid":"User name"}. +14ms

Here is how I'm generating the token :

 public function getAgoraTokenRTM($userName)
    {
        $rtm = new RtmTokenBuilder();
        $role = $rtm::RoleRtmUser;
        $expireTimeInSeconds = 3600;
        $currentTimestamp = (new DateTime("now", new DateTimeZone('UTC')))->getTimestamp();
        $privilegeExpiredTs = $currentTimestamp + $expireTimeInSeconds;
        return $rtm::buildToken(env('AGORA_APP_ID'), env('AGORA_CERTIFICATE_ID'), $userName, $role, $privilegeExpiredTs);
    }

Please could you tell me what's the mistake ? Also, I want to setup this tutorial for only audio (same as twitter space) , no need video, so could you please guide me how to achieve it. Thank you

akshatvg commented 2 years ago

You'll need to create a separate dynamic token for both RTC and RTM and pass them in the application separately. This error happens because of incorrect tokens being passed to the frontend.


I have written another tutorial explaining how you could Build Your Own Group Voice Calling Application Using the Agora Web SDK. This is a simple voice call application.

You could use the above sample app and just add the RTM messaging like I did in the "Invite User to Stage" repo.