locked
add credentials to service reference, twilio RRS feed

  • Question

  • I am trying to comsume REST service through https://api.twilio.com. I added the service reference to my LS project, but it keeps prompting me to enter credentials over and over. Is there any way to enter credentials when creating the service reference so this doesn't happen? Has anyone successfully consumed a rest service through LS?

    Saturday, August 16, 2014 3:22 PM

Answers

  • I used Twilio's REST API for SMS message sending and retrieving in the Silverlight client. I'm not sure if that's similar to what you are trying to do or not.

    Regarding authentication, you don't need to create a WCF RIA class or (actually the more preferred way for REST) a Web API class--you just need to use the twilio-csharp helper library specific C# API to interact with twilio's REST client.  You will need to instantiate the REST client class with your AccountSID and AuthToken:

    var twilio = new TwilioRestClient("AccountSidHere", "AuthTokenHere");

    For web-based (HTML) access to Twilio's REST client (which I didn't need for Silverlight projects), you'll need to include a "capability token" in your JavaScript programming.  See Twilio.Client.Capability for more info.

    • Marked as answer by Angie Xu Monday, August 25, 2014 2:14 AM
    Saturday, August 16, 2014 9:39 PM

All replies

  • Hi

    Try to consume the REST Service by using WCF RIA Service and retrieve the credential from web.config appsetting. This method may help you to work easily.

    HTH

    Regards


    Rashmi Ranjan Panigrahi
    www.lightswitchspecial.com

    If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”.
    This will help other users to find their answer quickly.

    Saturday, August 16, 2014 4:06 PM
  • I used Twilio's REST API for SMS message sending and retrieving in the Silverlight client. I'm not sure if that's similar to what you are trying to do or not.

    Regarding authentication, you don't need to create a WCF RIA class or (actually the more preferred way for REST) a Web API class--you just need to use the twilio-csharp helper library specific C# API to interact with twilio's REST client.  You will need to instantiate the REST client class with your AccountSID and AuthToken:

    var twilio = new TwilioRestClient("AccountSidHere", "AuthTokenHere");

    For web-based (HTML) access to Twilio's REST client (which I didn't need for Silverlight projects), you'll need to include a "capability token" in your JavaScript programming.  See Twilio.Client.Capability for more info.

    • Marked as answer by Angie Xu Monday, August 25, 2014 2:14 AM
    Saturday, August 16, 2014 9:39 PM