Ulli
Ulli

Reputation: 31

Agora.io generated token invalid ( C# / Angular )

I'm trying to get an Angular component to join an Agora video call using a token generated using C#.

When using a specific UID instead of "0" (permit all) the generated token fails with this error:

Error: Uncaught (in promise): AgoraRTCError CAN_NOT_GET_GATEWAY_SERVER: invalid token, authorized failed data: {"retry":false}

Token is generated using C# and the code from the Github Repo at https://github.com/AgoraIO/Tools/tree/master/DynamicKey/AgoraDynamicKey/csharp/src/AgoraIO

var token = new AgoraIO.Media.AccessToken(AGORA_APPID, AGORA_CERT, channelHash, userId);

where AGORA_APPID is the app id, AGORA_CERT the certificate, channelHash is a hash value for the channel, and userId is a guid.

Token is then retrieved by an Angular component, and used to join a channel, using the AgoraWebSDK-NG typescript SDK.

Using an unspecified UID (0 during creation, null during joining) works fine, so AppId, Cert, and channelHash are probably good.

Using a specified UID, be it numeric or alpha, leads to the invalid token error.

Does anyone have an idea what might be wrong?

Upvotes: 1

Views: 1296

Answers (1)

Ulli
Ulli

Reputation: 31

Sorry I bothered, figured it out late at night. My bad for trusting my own input, i found that i used a different hash method for the channel name...

Upvotes: 2

Related Questions