Reputation: 8606
In my Azure AD App i am trying to retrieve Access Token in below section
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);
},
and i am getting below error
{"AADSTS70002: Error validating credentials. AADSTS50011: The reply address 'https://localhost:44301/' does not match the reply address 'https://localhost:44301' provided when requesting Authorization code.\r\nTrace ID: fd34bd6b-37d5-4b66-85d0-657b27103049\r\nCorrelation ID: ea970ddb-cab8-4949-b749-1b4a8d7b5a6b\r\nTimestamp: 2016-08-25 06:44:59Z"}
In Azure portal i have double checked that reply URL should match
what should be issue here?
Upvotes: 1
Views: 4021
Reputation: 10672
Your redirect URIs need to be identical. In your case, one has a slash at the end and the other doesn't.
Upvotes: 5