Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
getting this error object does not contain a definition for and no accessible extension method on result
token = auth.GetTokenAsync(new Uri(TokenURL), PCAClientUID, PCASecret, EnsResource, "OAuthV2")result;

What I have tried:

public string GetToken1()
{


token = CacheEngine.Get<string>(tokenkey);
if (string.IsNullOrEmpty(token))
{

AuthTokenGeneration auth = new();

//TokenURL = Convert.ToString(configuration["Shared:TokenURL"]);
token = auth.GetTokenAsync(new Uri(TokenURL), PCAClientUID, PCASecret, EnsResource, "OAuthV2").result;
CacheEngine.Set<string>(tokenkey, token, cacheInterval);
}


HttpClient httpClient = new();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
HttpContent content = new StringContent(JsonConvert.SerializeObject(pcaStandardActionPayload), Encoding.UTF8, "application/json");
var postResult = httpClient.PostAsync(EnsAmNotificationUrl, content).Result;

return token;
}
Posted
Updated 22-Jul-21 21:49pm

1 solution

The AuthenticationTokenExtensions.GetTokenAsync Method[^] does not contain an overload that accepts a URI as the first parameter - which is why it complains when you try to pass it one.

Look at the link, and you will see what you can pass.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900