fix: change RT in cache after generation
This commit is contained in:
parent
612efcb91c
commit
f89136669d
@ -81,14 +81,18 @@ public class AuthService(ICacheService cache, IAccessToken accessTokenService, I
|
|||||||
var (token, expireIn) = GenerateAccessToken(authToken.UserId);
|
var (token, expireIn) = GenerateAccessToken(authToken.UserId);
|
||||||
await RevokeAccessToken(authToken.AccessToken);
|
await RevokeAccessToken(authToken.AccessToken);
|
||||||
|
|
||||||
|
var newRefreshToken = GenerateRefreshToken();
|
||||||
|
|
||||||
authToken.AccessToken = token;
|
authToken.AccessToken = token;
|
||||||
|
authToken.RefreshToken = newRefreshToken;
|
||||||
|
|
||||||
await SetAuthTokenDataToCache(request.Fingerprint, authToken, cancellation);
|
await SetAuthTokenDataToCache(request.Fingerprint, authToken, cancellation);
|
||||||
|
|
||||||
return new AuthTokenResponse
|
return new AuthTokenResponse
|
||||||
{
|
{
|
||||||
AccessToken = token,
|
AccessToken = token,
|
||||||
AccessExpiresIn = expireIn,
|
AccessExpiresIn = expireIn,
|
||||||
RefreshToken = GenerateRefreshToken(),
|
RefreshToken = newRefreshToken,
|
||||||
RefreshExpiresIn = DateTime.UtcNow.Add(Lifetime)
|
RefreshExpiresIn = DateTime.UtcNow.Add(Lifetime)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user