Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTM Token samples missing channelName #82

Closed
sleman opened this issue Jun 8, 2020 · 9 comments
Closed

RTM Token samples missing channelName #82

sleman opened this issue Jun 8, 2020 · 9 comments

Comments

@sleman
Copy link

sleman commented Jun 8, 2020

When calling the buildToken method with all the required arguments downloaded from: https://github.com/AgoraIO/Tools/blob/master/DynamicKey/AgoraDynamicKey/php/src/RtmTokenBuilder.php

$token is always null

and then the next line fails because $token is null

$token->addPrivilege($Privileges["kRtmLogin"], $privilegeExpireTs);

buildToken calls AccessToken::init without a channelName while the method requires a channeName in the function definition.

The same issue exists in your python3 and javascript samples in the master branch.

Even after fixing this issue, now I am getting an error when calling rtm api join.
RTM:ERROR Error Code 5. Signature verification failed.

@plutoless
Copy link
Contributor

umm i tried php version and it's working properly for me. which php version are you using?

bash-3.2$ php RtmTokenBuilderSample.php
Rtm Token: 006970CA35de60c44645bbae8a215061b33IADhrR1vsVX3JqBO951BdxlKa7OVqwT7MGhhp86rpgdXd10HL3sAAAAAEAAdcgAA9DfnXgEA6AOE9OVe
bash-3.2$

it you look into the code you will notice rtm token builder is placing userAccount in init function channelName field. so as long as you provide userAccount, it should not return null.

@plutoless
Copy link
Contributor

maybe you can try running the sample code in sample folder? does that return you null as well?

@RalphLincoln
Copy link

RtmUnauthenticatedError: Error Code 5 - Signature verification failed. I keep getting this error. How do I resolve this?

@alexanza
Copy link

@RalphLincoln Did you use the same uid on the token generator and in the client ?

@RalphLincoln
Copy link

RalphLincoln commented Feb 15, 2021

Yes I did...... @alexanza

@plutoless
Copy link
Contributor

@RalphLincoln sorry for late reply. could you pls help share the token you generated with me.

@RalphLincoln
Copy link

It's been quite a long time now, I decided to move on without the token. But is the token needed in production. Could it break the application?

@amanvision
Copy link

amanvision commented Sep 16, 2021

Hi there,
Sample code works correctly, Following works for me:

Generate your $userAccount or $uid as:

$user = random_int(100000000, 999999999);
$user = (string)$user;
IMP: make sure you cast user id to string.

Pass this to RtmTokenBuilder::buildToken

Also, pass the same user id to AgoraEduSDK.launch config (userUuid)

@meyfemi
Copy link

meyfemi commented Nov 22, 2021

I found the issue, in the RtmTokoenBuilder.php class, update buildToken() method with the code snippet below

 public static function buildToken($appID, $appCertificate,$channelName, $userAccount, $role, $privilegeExpireTs){
        $token = AccessToken::init($appID, $appCertificate, $channelName,$userAccount);
        $Privileges = AccessToken::Privileges;
        $token->addPrivilege($Privileges["kRtmLogin"], $privilegeExpireTs);
        return $token->build();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants