Create "refresh token" action filter
I can see repetitive code which you can fix easily..

Before

//Remove old tokens:
var oldRefreshToken = user.Claims.Single(c =&gt; c.Type == AuthenticationValues.RefreshTokenKey);
var oldAccessToken = user.Claims.Single(c =&gt; c.Type == AuthenticationValues.AccessTokenKey);
var oldExpiresAt = user.Claims.Single(c =&gt; c.Type == AuthenticationValues.ExpiresAtKey);
var oldEpoch = user.Claims.Single(c =&gt; c.Type == AuthenticationValues.ExpiresAtEpochKey);
identity.RemoveClaim(oldRefreshToken);
identity.RemoveClaim(oldAccessToken);
identity.RemoveClaim(oldExpiresAt);
identity.RemoveClaim(oldEpoch);


After

var tokens = user.Claims
    .Where(c =&gt;
        c.Type == AuthenticationValues.RefreshTokenKey ||
        c.Type == AuthenticationValues.AccessTokenKey ||
        c.Type == AuthenticationValues.ExpiresAtKey ||
        c.Type == AuthenticationValues.ExpiresAtEpochKey);

foreach (var token in tokens)
{
    identity.RemoveClaim(token);
}




You have filter claims by its type many times, which is similar code. You can get rid of duplicate code by introducing a method. I am not sure about the return or parameter type but it look somehow like below.

public static string GetClaimsType(string type)
{
    return ClaimsPrincipal.Current.Claims.Where(c =&gt; c.Type == type).Select(c =&gt; c.Value).SingleOrDefault();
}


Now your code will be much cleaner and shorter..

Before

var claims = ClaimsPrincipal.Current.Claims;
var refreshToken = claims.Where(c =&gt; c.Type == AuthenticationValues.RefreshTokenKey).Select(c =&gt; c.Value).SingleOrDefault();
long epoch = Convert.ToInt64((claims.Where(c =&gt; c.Type == AuthenticationValues.ExpiresAtEpochKey).Select(c =&gt; c.Value).SingleOrDefault()));


After

var refreshToken = GetClaimsType(AuthenticationValues.RefreshTokenKey);
long epoch = Convert.ToInt64(GetClaimsType(AuthenticationValues.ExpiresAtEpochKey));