Authentication to Upcoming API from .Net app

Hi all,
I know this is trivial to you, but i am a noob to REST API. My problem is that i am using an web app to access the upcoming api. I hosted that at my local host and registered it with upcoming from your get api key form page with following steps,
1. First I generated the API key
2. I placed my app name say eventuploader
3. Added the call back url as http://localhost:3786/default.aspx
4. Save the changes with the api key.
Now when i use my api key to auth usin httpwebrequest class , it will redirect me to login/signup page , that is fine. After login they redirect me to localhoat with frob in querystring , which is also fine.
Now what i did is that , since this is my non commercial code so , i hardcoded this to my source and made it something like that for getting the token [stucked here]. sad.gif
string Authuri = "http://upcoming.yahoo.com/services/auth/?api_key=d8414d2e93";
string frob = "2bee6ae580c7f810d37d338cf9d95c28fd80ae0d";
private void GetToken()
Authuri += "&frob=" + frob+"&method=auth.getToken" ;
// Create the web request
request = WebRequest.Create(Authuri) as HttpWebRequest;
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());

ScriptManager.RegisterStartupScript(this, GetType(), "msgal", "alert('" + reader.ReadToEnd()+ "')", true);

but instead of getting the token i am redirected to a blank page. or sometimes missing api key page. I dont why such things happens. Where as the above code works fine for searching events, it give me a huge xml of events.

So you guys are requested to help me out and point out too, where i made mistake.

Looking for a quick reply smile.gif

Amit Ranjan

0 Replies
This forum is locked.

Recent Posts

in Upcoming API - General Questions