C
C#2mo ago
Confident

Simple help in httpclient c#

I started to learn C# recently. I tried to do on postman and it was successfull. i wanna implement that feature with httpclient c#, but i face an issue. Who can help me?
19 Replies
Pobiega
Pobiega2mo ago
$details
MODiX
MODiX2mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code! (see $code for more information on how to paste your code)
Pobiega
Pobiega2mo ago
Noone can help you if you don't ask your question. Include the code you currently have, and as much info on the request that worked in postman as possible.
SG97
SG972mo ago
and postman can generate the httpclient request for you as a fully working piece of code
Confident
ConfidentOP2mo ago
This is my current code block
Confident
ConfidentOP2mo ago
BlazeBin - jjlwdaoxyddi
A tool for sharing your source code with the world!
Nasdack
Nasdack2mo ago
What is the issue you're facing? "but I face an issue" does not explain anything
Confident
ConfidentOP2mo ago
upload result: {"errors":[{"code":32,"message":"Could not authenticate you."}]} The Share provider returned a Not Authorized message: '{"errors":[{"code":32,"message":"Could not authenticate you."}]}' that is error authorization error 401 status cod
Nasdack
Nasdack2mo ago
Tbe Twitter API Twitter requires authorisation And you're not doing that Read their API docs to see what authentication method they use Probably an API token or an auth bearer token
Confident
ConfidentOP2mo ago
thanks for your support. So I have just resolved
Confident
ConfidentOP2mo ago
No description
Confident
ConfidentOP2mo ago
but weird things are still existed in my code. i used static value like that
Nasdack
Nasdack2mo ago
What static value?
Confident
ConfidentOP2mo ago
You can see on this oauth signature originally, i have to make it per reques i made it but it's not working. and that was my main issue
Nasdack
Nasdack2mo ago
It should not be hardcoded in the first place
Confident
ConfidentOP2mo ago
What do you mean? I am not familiar with it.. Could you please tell me detail? possibly, with solution yeah, i know, but i can't install any packages like .net frameworks because it's running on ninjatrader 8
Nasdack
Nasdack2mo ago
You shouldn't hard code your API tokens Store and retrive them in a file somewhere, or use env secrets
Confident
ConfidentOP2mo ago
api token? you mean oauth token or consumer key ?
Nasdack
Nasdack2mo ago
Same thing
Want results from more Discord servers?
Add your server