Tools icon indicating copy to clipboard operation
Tools copied to clipboard

Missing Generate RTM token exmple in C#

Open arnoldsi-vii opened this issue 2 years ago • 2 comments

The AccessToken method require channel name, while RTM doesn't really need it. In order to make it work we need to pass empty string as channel and add

tokenBuilder.addPrivilege(Privileges.kRtmLogin, 0);

It will be nice if you could add another signature to AccessToken without channel name

arnoldsi-vii avatar Feb 26 '22 22:02 arnoldsi-vii

@arnoldsi-vii the assumption is not true. RTM does not need a channel name but it needs a string account. in this case you will have to put RTM account into AccessToken channel field... we do have rtm token example in other languages. maybe you can take a look at these if needed. we will see if we can add the missing c# example

plutoless avatar Mar 04 '22 02:03 plutoless

@plutoless We needed to do one login and have ability to join multiple channels with this login. This is how we did it:

 var tokenBuilder = new AccessToken(_agoraIOConfig.Value.AppID, 
                    _agoraIOConfig.Value.AppCertificate, 
                    "", GetUserId.ToString());

            tokenBuilder.addPrivilege(Privileges.kRtmLogin, 0);
            tokenBuilder.addPrivilege(Privileges.kJoinChannel, 0);

            return Ok(new
            {
                Token = tokenBuilder.build(),
            });

I'm don't know if it's by design, but it works well

arnoldsi-vii avatar Mar 04 '22 09:03 arnoldsi-vii