Skip to content

How to retrieve using the Client code the Access Token generated on the Server-side?

Looking at the Twilio documentation it seems that “you create [Access Tokens] on your server to verify a user’s identity and grant access to client API features.”

Here, Twilio provides a few different ways to programmatically create Access Tokens on the Server side – it looks pretty straight forward.

I am developing an Android app-to-app calling feature and for this I’ve have been using the Android quickstart-project to go about it. However, for this code, the implementation and execution are done by copying and pasting Access Tokens generated through either the Twilio Console or Twilio-CLI commands.

Say we have our Server set up, a TwiML app and its associated URL, what would be the simplest and most straight-forward way to generate but then retrieve the access token from the Server to the Client app?



From my understanding, you would like to access Twilio API using an access token. In that case, you should have a backend server that stores the access token because you shouldn’t store such tokens in the client-side (android app). Your app would send request to your backend which would then use the access code to access the api and forward you the result back.

User contributions licensed under: CC BY-SA
9 People found this is helpful