I am using Azure AD v1 endpoint to authorize my webapp.
On initial authentication , I am not getting access_token to be a valid jwt token. However i am getting id_token to be valid jwt and the acces_token to be value of refresh_token which appears strange.
I can call my Web API using id_token as bearer token. All good.
Now when id_token is expired , i am using my refresh_token to send following refresh token request .I am getting unsigned id_token as response. Since the new id_token is unsigned , using this id_token i am not able to access Web API. Am i missing something?
POST /token HTTP/1.1
Host: {authority}
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&
client_id=mvc&
client_secret=secret&
refresh_token=AQABAAAAAADX8GCi6J
&scope=openid%20profile%20offline_access
I am using following startup configuration to set up authentication
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.ExpireTimeSpan = TimeSpan.FromSeconds(1000);
options.Cookie.Name = "mvcapplication";
})
.AddOpenIdConnect(option=>{
options.Authority = "{aad v1 endpoint}";
options.ClientId = "mvc";
options.ClientSecret = "secret";
options.ResponseType = "code id_token";
options.ResponseMode = "form_post";
options.SignInScheme = "Cookies";
options.CallbackPath = "/Home/Index/";
options.RequireHttpsMetadata = false;
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
//Default Scopes
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("offline_access");
});