How do I write my Flurl code to obtain this result, please ?
a. See, I have the header "Authorization" as in this image:
b. And I have these values in the body:
With these, my Get obtains this result
So in C# I have this:
string clientID = ...;
string clientSecret = ...;
string authCredentials = $"{clientID}:{clientSecret}".Base64Encode(); //This value will be validated.
BearerToken result = serviceURL
.AppendPathSegment("token")
.WithHeaders(new
{
grant_type = "esslogin",
ssusername = user,
sspassword = password
})
.WithHeader("Authorization", $"Basic {authCredentials}")
.GetJsonAsync<BearerToken>().Result;
Alas, I get "One or more errors occurred. (Call failed with status code 400 (Bad Request): GET https://demoservices64..../Login.Secured/token)
I have noticed that I would need to add the grant_type, ssusername, and sspassword into the body and not as params in the header.
How should I write the above using Flurl, please ?
Thank you