1

I want to use the "Sign in with twitter" using twitter's updated REST 1.1 JSON API in Windows Phone 7/8 using C# & XAML.

I am very much confuse what exactly to be used while making a call to these API (like WebClient or HttpWebRequest or any other). also how to pass the headers n all and make the calls.

I have created the developer app on twitter's dev a/c and got the access token and secrete.

Can anybody help me by giving any sample code of making a REST 1.1 API call in Windows Phone for the following?

  1. Login to Twitter using OAuth authentication
  2. Get the user details without using any third party library
  3. Get user time line tweets/ tweet on behalf/ Invite friends

Thanks in advance!

  • Have you seen this? http://stackoverflow.com/questions/17067996/authenticate-and-request-a-users-timeline-with-twitter-api-1-1-oauth/17071447#17071447 – hutchonoid Nov 21 '13 at 21:40

1 Answers1

1

Have you looked at Azure mobile services?

The implementation is very simple. Azure authentication

The authentication returns a userid of the logged in user. Then you can query the twitter api for userdetails and tweets.

public async Task<string> GetMyData(string urlToCall)  {     
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlToCall);     
request.Method = HttpMethod.Get;     
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();     
using (var sr = new StreamReader(response.GetResponseStream()))      
{         
    return sr.ReadToEnd();      
}  

}

Jonas K
  • 95
  • 7
  • How can be the returned userid used as an OAuth Authorization while making the REST API calls? Can you please explain in more details as now every twitter REST api requires the user authentication while making the queries. – Jagdish Chopde Nov 19 '13 at 13:23