Je suis les instructions de la page this. Je me suis créé un service Windows et je suis bloqué à demander le jeton d'accès d'Azure AD. J'ai réussi à obtenir un code d'autorisation mais j'obtiens l'erreur redirect_uri quand je POST. Voici à quoi ressemble mon code:AADSTS90102: la valeur 'redirect_uri' doit être une valeur absolue absolue. Uri
var dictionary = new Dictionary<string, string>
{
{ "resource", "https%3A%2F%2Foutlook.office365.com"},
{"client_id","Application ID from azure AD portal" }, //-is this ok?
{"client_secret","Object ID from azure AD portal" }, //-is this ok?
{"grant_type","authorization_code" },
{"redirect_uri",HttpUtility.UrlEncode("https://haw.trustteam.be/") },
{ "code","AQABAAIAAAAB..1AiAA"}
};
var content = new FormUrlEncodedContent(dictionary);
string requestUrl = "https://login.windows.net/common/oauth2/token"; // also tried with login.microsoftonline.com
using (HttpClient client = new HttpClient())
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, requestUrl);
request.Content = content;
using (HttpResponseMessage response = await client.SendAsync(request))
{
string responseString = await response.Content.ReadAsStringAsync();
return response.Content.ToString();
}
}
Qu'est-ce que je fais de mal?