AgoraIO / Tools

383 stars 828 forks source link

Add API for synchronous token validation #350

Closed ByronBecker closed 1 month ago

ByronBecker commented 10 months ago

I'm currently storing the generated RTC token in local storage, and would like to be able to verify that the generated token is valid/expired without making an API call to the server.

This way, if the token is invalid I can save a round trip (not needing to receive a 403 before refreshing the token).

Ideally this API would live in the agora-token repository 🙏

sunshinexcode commented 3 months ago

@ByronBecker To verify whether a token is expired, you can call and use access_token = AccessToken(); access_token.from_string(token) to parse out the expiration time to judge. For reference, you can look into parse.py