0
나는 this 페이지의 지침을 따르고 있습니다. 나 자신에게 윈도우 서비스를 만들었고 Azure AD의 액세스 토큰을 요청할 때 막혔습니다. 인증 코드를 얻을 수 있었지만 POST 할 때 redirect_uri 오류가 발생했습니다. 내 코드는 다음과 같습니다.AADSTS90102 : 'redirect_uri'값은 유효한 절대 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();
}
}
내가 뭘 잘못하고 있니?