Reputation: 36
I am having issue joining a channel. I am making us of agora-web-sdk-ng.
Below is my code to join a channel:
async startVideoStream() {
this.rtc.client = AgoraRTC.createClient({ mode: "live", codec: "h264", role: 'host' });
const uid = await this.rtc.client.join(this.options.appId, this.options.channel, this.options.token || null);
this.rtc.localAudioTrack = await AgoraRTC.createMicrophoneAudioTrack();
this.rtc.localVideoTrack = await AgoraRTC.createCameraVideoTrack();
this.rtc.localVideoTrack.play('streamVideo')
await this.rtc.client.publish([this.rtc.localAudioTrack, this.rtc.localVideoTrack]);
}
But for unknown reasons, I keep on getting this error:
core.js:4197 ERROR Error: Uncaught (in promise): AgoraRTCError CAN_NOT_GET_GATEWAY_SERVER: invalid token, authorized failed data: {"retry":false} at resolvePromise
Upvotes: 1
Views: 5843
Reputation: 1182
I think the token needs to be the first param for that join
call:
const uid = await this.rtc.client.join(this.options.token || null, this.options.channel, this.options.appId);
Upvotes: 0