C
C#17h 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
Pobiega17h ago
$details
MODiX
MODiX17h 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
Pobiega17h 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
SG9715h ago
and postman can generate the httpclient request for you as a fully working piece of code
Confident
Confident15h ago
This is my current code block
Confident
Confident15h ago
BlazeBin - jjlwdaoxyddi
A tool for sharing your source code with the world!
Nasdack
Nasdack14h ago
What is the issue you're facing? "but I face an issue" does not explain anything
Confident
Confident14h 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
Nasdack14h 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
Confident14h ago
thanks for your support. So I have just resolved
Confident
Confident14h ago
No description
Confident
Confident14h ago
but weird things are still existed in my code. i used static value like that
Nasdack
Nasdack14h ago
What static value?
Confident
Confident14h 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
Nasdack14h ago
It should not be hardcoded in the first place
Confident
Confident14h 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
Nasdack14h ago
You shouldn't hard code your API tokens Store and retrive them in a file somewhere, or use env secrets
Confident
Confident14h ago
api token? you mean oauth token or consumer key ?
Nasdack
Nasdack14h ago
Same thing
Want results from more Discord servers?
Add your server