agora-group-calling icon indicating copy to clipboard operation
agora-group-calling copied to clipboard

response.statusCode gives 404?

Open Muhammad-Ullah opened this issue 2 years ago • 1 comments

I am using this function to get the token, passing a random channel name but it gives error 404? Future getToken() async { final response = await http.get( Uri.parse(baseUrl + '/rtc/' + widget.channelName + '/publisher/uid/' + uid.toString() // To add expiry time uncomment the below given line with the time in seconds // + '?expiry=45' ), );

if (response.statusCode == 200) {
  setState(() {
    token = response.body;
    token = jsonDecode(token)['rtcToken'];
  });
} else {
  print('Failed to fetch the token');
}

}

Muhammad-Ullah avatar May 23 '22 19:05 Muhammad-Ullah

Please follow this guide to generate a token server: https://github.com/AgoraIO-Community/agora-token-service

Meherdeep avatar May 24 '22 19:05 Meherdeep