Ale Kantousian
Ale Kantousian
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
Humm ok
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
return 401
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
About https and http
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
I didn't understand what you meant
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
So, yesterday I tried several solutions according to the documentation, according to StackOverFlow and today here with your tips, I find it very difficult for 3 different way to all go wrong when all 3 showed similar or identical solutions.
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
Unfortunately not, that's why I told you that I think it's some .NET bugs 😕
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
Yes
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
var client = new HttpClient();
var request = new HttpRequestMessage {
Method = HttpMethod.Get,
RequestUri = new Uri("MyUrl"),
Headers =
{
{ "Authorization", "MyToken" },
//{ "Postman-Token", "<calculated when request is sent>"},
//{ "Host", "calculated when request is sent" },
//{ "User-Agent", "PostmanRuntime/7.32.2" },
{ "Accept", "*/*" },
{ "Accept-Encoding", "gzip, deflate, br" },
{ "Connection", "keep-alive" },
//{ "Content-Type", "application/json" },
},
};
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new HttpClient();
var request = new HttpRequestMessage {
Method = HttpMethod.Get,
RequestUri = new Uri("MyUrl"),
Headers =
{
{ "Authorization", "MyToken" },
//{ "Postman-Token", "<calculated when request is sent>"},
//{ "Host", "calculated when request is sent" },
//{ "User-Agent", "PostmanRuntime/7.32.2" },
{ "Accept", "*/*" },
{ "Accept-Encoding", "gzip, deflate, br" },
{ "Connection", "keep-alive" },
//{ "Content-Type", "application/json" },
},
};
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
The same again, 401 😕
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
Hummmmm give me a second
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
Sometimes I think this is a bug in .NET
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
I tried this, but I got the same 401 😕
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
No, my real token is another one, I put that one just to illustrate in the image
35 replies
CC#
Created by Ale Kantousian on 6/1/2023 in #help
✅ Add OAuth 2.0 in HttpClient Request Headers
How can I add "OAuth 2.0" in my Get, when I try to request with this code, I have the following unauthorized 401 error. My token is correct, because I tested the request in postman
35 replies
CC#
Created by Ale Kantousian on 4/14/2023 in #help
Blazor doesn't add CSS Isolation file ✅
It works! thanks friend! 😄
4 replies
CC#
Created by Ale Kantousian on 3/3/2023 in #help
❔ Response 413
It works, thank you
6 replies
CC#
Created by Ale Kantousian on 3/3/2023 in #help
❔ Response 413
Does anyone have an idea how to resolve?
6 replies
CC#
Created by Ale Kantousian on 2/14/2023 in #help
Send by value in Body with HttpClient class
It worked, thanks friend!
4 replies