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

Oauth2 with HttpClient (C#'s class does not allow POST requests without body)

ANSWERED

I'm trying to do oauth2 with .NET HttpClient with C# actually seems that I'm unable to do the following exact POST request with C#.

While I was able to authenticate and get the access_token and refresh_token from postman, I was unable to do that with C#. Has anyone ever had success to make fitbit authentication with C#? thanks. Seems everytime I try from c# I get 401. The Basic (base64 client_id:client_secret) header is correct, seems somewhat either C# is using a wrong encoding or is appending useless information to the POST request, from the debugger I don't see differences with the C# request and the PostMan request.

Note the above Postman request is working correctly, so I'm trying to reproduce exactly with C#.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Ok i resolved anyway. Thanks!

View best answer in original post

Best Answer
0 Votes
5 REPLIES 5

Ok i resolved anyway. Thanks!

Best Answer
0 Votes

Hi,

I really in need of complete c# code to get oAuth access token, replication of Postman, can you please share. 

Best Answer
0 Votes

Hi @spulakandam 

 

Have you checked out Aaron Coleman's sample found on our web site: https://dev.fitbit.com/build/reference/web-api/community-resources/?

 

Gordon

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

Hey, 

 

I m using the https://github.com/Clancey/SimpleAuth SimpleAuth from Clancey, Its

awesome.

 

Best Answer
0 Votes

Hi @DeniOcean 

 

Thank you for the recommendation.

 

Gordon

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