Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sending request to API via a MVC ASP.NET C# web app

Last year I made an app that used fitbit data and the tutorial page was very easy to follow.


Now it has changed and I am unsure how to use the curl data given to me to complete my request.

curl.PNG

 

 

At the moment I get an unauthorized error in my code, and I think that is because I am not setting the client id and secret id with the request.


Can anyone help me?

 

            string url = secret.ajaxUrl;
            WebRequest myReq = WebRequest.Create(url);
            string credentials = secret.clientID + ":" + secret.secretID;
            CredentialCache mycache = new CredentialCache();
            myReq.Headers["Authorization"] = "Basic " + CODE;
            myReq.ContentType = "application/x-www-form-urlencoded";
            WebResponse wr = myReq.GetResponse();
            Stream receiveStream = wr.GetResponseStream();
            StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
            string content = reader.ReadToEnd();
Best Answer
0 Votes
3 REPLIES 3

Hi @impo,

 

I'll be happy to clarify the OAuth process for you.  Are there certain pieces of the curl command that you need clarified?

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Hi @GordonFitbit,

 

Thanks for the reply!
But I managed to get it working. just don't ask how because I don't know what I did

 

I did a lot of digging through the forums and found a nearly working example I was able to edit enough to get the returns I needed. 

Best Answer
0 Votes

Congrats!  Thanks for the update.  Please use the forums again if you have further questions.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes