Using ADAL I have two AuthenticationContext
using a Token Cache persisted in SQL.
Using AcquireTokenByAuthorizationCode
it writes the Token
I had the same issue in ASPNetCore (1.0) and the reason was that I wasn't storing the authentication token after logging in. I solved it by adding OnAuthorizationCodeReceived
in the Startup class and changing my Response ype to ResponseType = OpenIdConnectResponseType.CodeIdToken
.
Hope it helps.
Sample: https://github.com/Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect-aspnetcore/blob/aspnet10/WebApp-WebAPI-OpenIdConnect-DotNet/Startup.cs#L100