AgoraIO / Docs-Source

A repository for the Agora Docs source content.
MIT License
20 stars 11 forks source link

Signature does not match documentation #1504

Closed MetaSeth closed 10 months ago

MetaSeth commented 11 months ago

Platform

Web

Platform details

I'm only using the web product, but i guess it could be on others platform too.

Product

Video Calling

Product details

RtcTokenBuilder.buildTokenWithUid signature

Business Case

Simpler for new users

Subject Matter Expert

RtcTokenBuilder.buildTokenWithUid() expects 6 arguments, but only 5 are provided in the documentation. The token_expire argument is missing in the example.

Should be something like that:

const expirationTimeInSeconds = 3600;
const tokenA =RtcTokenBuilder.buildTokenWithUid(appID, appCertificate, channelName, uid, role, tokenExpirationInSecond, privilegeExpiredTs);

Documentation Link

https://docs.agora.io/en/video-calling/develop/integrate-token-generation?platform=web#implement-token-generation

Scope

No response

Acceptance Criteria

The documentation update should be technicaly accurate.

Additional Information

No response

Edit: I made a mistake when describing the error. It was Expected 7 arguments, but got 6.ts(2554) index.d.ts(26, 159): An argument for 'privilege_expire' was not provided. I have posted an example.

Kishan-Dhakan commented 11 months ago

The doc at https://docs.agora.io/en/video-calling/develop/integrate-token-generation?platform=web#implement-token-generation seems to be working fine for me. Could you share steps to reproduce or your code? @saudsami there was an unrelated issue that I have fixed in https://github.com/AgoraIO/Doc-Source-Private/pull/818

MetaSeth commented 11 months ago

Here a little repo showing the issue

Kishan-Dhakan commented 10 months ago

Fixed by https://github.com/AgoraIO/Doc-Source-Private/pull/870. @MetaSeth this will updated in the next publish. For your use, you may use the correct code:

const tokenA = RtcTokenBuilder.buildTokenWithUid(
      appId,
      appCertificate,
      channelName,
      uid,
      role,
      expirationTimeInSeconds,
      privilegeExpiredTs
    );

const tokenB = RtcTokenBuilder.buildTokenWithUserAccount(
    appId,
    appCertificate,
    channelName,
    userAccount,
    role, 
    privilegeExpiredTs);