1

The Question: As the title, my question is how to get client Access Token directly using REST API (not using the Server-SDK).

The Reason: I am trying to build a game which uses GameSparks as the back-end and Twilio as the Video Streaming service.

In order to connect to Twilio, I will need a back-end server to generate the Access Token for the client devices. GameSparks on another hand does not allow me to import any external library (including Twilio Server-SDK), sequentially I cannot generate the Twilio's Access Token within GameSparks. However, GameSparks allows creating HTTP request to another server to obtain resources.

So my idea is to obtain the Access Token directly by using HTTP to an external server. Since I am using GameSparks as my back-end, I do not want to maintain extra servers just for Twilio authentication.

So my idea is I will create a HTTP request from inside GameSparks to obtain the Access Token from Twilio, but I cannot find any REST API allow me to do so.

pthr
  • 41
  • 1
  • 4
  • 2
    Have you looked at Twilio Functions? Its a serverless product that by default imports the Twilio Node helper library. You could create a function that generates and returns the token, then have your app make an HTTP request to the function URL. https://www.twilio.com/functions – Devin Rader Nov 10 '17 at 18:05
  • This send sms by twilio api. How do you want to use Twilio as Video Streaming service? var twForm = "To=" + encodeURIComponent(twTo) + "&Body=" + encodeURIComponent(twBody) + "&MessagingServiceSid=xyz"; var response = Spark.getHttp(twilio).setBasicAuth(twKey, twToken).setHeaders({"Content-type":"application/x-www-form-urlencoded"}).postString(twForm); Spark.getLog().debug(response.getResponseJson()); More here https://www.twilio.com/docs/usage/api – lunix15 Aug 27 '18 at 15:57

0 Answers0