Refresh token works fine for 2 to 3 days but after few days it stops working.
On Authentication call for
grant_type = refresh_token
IIS return Bad request 400 with error message
{error : "invalid_grant"}
temporary solution
it works fine by restarting/recycling API instance on IIS.
Unable to find what is the issue with the IIS or the Owin why it works fine for few days while i have set an expiry time of 30 days for the refresh token.
This is the code used for refresh token
var token = new RefreshToken()
{
RefreshTokenId = refreshTokenId,
ClientId = clientid,
UserEmail = context.Ticket.Identity.Name != clientid ? context.Ticket.Identity.Name : null,
IssuedOn = DateTime.UtcNow,
ExpiresOn = DateTime.UtcNow.AddDays(30)
};
context.Ticket.Properties.IssuedUtc = token.IssuedOn;
context.Ticket.Properties.ExpiresUtc = token.ExpiresOn;
token.ProtectedTicket = context.SerializeTicket();
I will be thankful for Any help regarding this issue.