在我的Azure AD App中,我试图在下面的部分中检索访问令牌
AuthorizationCodeReceived = (context) =>
{
var code = context.Code;
ClientCredential credential = new ClientCredential(ClientId, appKey);
string signedInUserID = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value;
AuthenticationContext authContext = new AuthenticationContext(Authority, new ADALTokenCache(signedInUserID));
AuthenticationResult result = authContext.AcquireTokenByAuthorizationCode(
code, new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path)), credential, graphResourceID);
return Task.FromResult(0);
},
我的错误
{" AADSTS70002:验证凭据时出错。 AADSTS50011:回复 地址' https://localhost:44301/'与回复地址不符 ' https://localhost:44301'请求授权时提供 代码。\ r \ nTrace ID:fd34bd6b-37d5-4b66-85d0-657b27103049 \ r \ n相关 ID:ea970ddb-cab8-4949-b749-1b4a8d7b5a6b \ r \ n时间戳:2016-08-25 06:44:59Z"}
答案 0 :(得分:5)
您的重定向URI必须相同。在你的情况下,一个在结尾有一个斜线而另一个没有。