(Agora) agora-rtc-react renewToken() method failed

54 Views Asked by At

First of all, I'm not good at English, so some sentances are strange or rude... Please understand. I'm new to Agora and using agora-rtc-react for making voice calling with React web. Now I'm trying to renew my agora token that I got issued when entering a voice channel. So using agoraClient's renewToken() method, but it doesn't work. I got the error below.

Agora-SDK [ERROR]: data: {"code":110,"data":{"error_code":110,"error_str":"error to verify token permission"}} AgoraRTCException: AgoraRTCError UNEXPECTED_RESPONSE: ERR_NO_AUTHORIZED: error to verify token permission

And here's my code.

useClientEvent(agoraEngine, "token-privilege-will-expire", async () => {
   try {
      console.log("renew token");

      const { data } = await axios.post(
        "[[ My Token Server Host ]]",
        undefined,
        {
          headers: {
            Authorization: `Bearer ${tempToken}`,
          },
        }
      ); // succeed
    
      await agoraEngine.renewToken(data.data.token); // failed
    } catch (e) {
      console.error(e);
    }
});

Getting new token was succeed, but renew token was failed. I've tried to find any articles or questions but couldn't found. What is wrong and How can I fix this error?

I tried to figure out the token is valid, I used that new token to join the channel and it worked as well. Only Using renewToken() method is problem.

0

There are 0 best solutions below