From f89136669d5fb7c9620ecdaacf78c8ad1c236558 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Fri, 28 Jun 2024 22:52:05 +0300 Subject: [PATCH] fix: change RT in cache after generation --- Security/Services/AuthService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Security/Services/AuthService.cs b/Security/Services/AuthService.cs index d932dd1..5b293b3 100644 --- a/Security/Services/AuthService.cs +++ b/Security/Services/AuthService.cs @@ -81,14 +81,18 @@ public class AuthService(ICacheService cache, IAccessToken accessTokenService, I var (token, expireIn) = GenerateAccessToken(authToken.UserId); await RevokeAccessToken(authToken.AccessToken); + var newRefreshToken = GenerateRefreshToken(); + authToken.AccessToken = token; + authToken.RefreshToken = newRefreshToken; + await SetAuthTokenDataToCache(request.Fingerprint, authToken, cancellation); return new AuthTokenResponse { AccessToken = token, AccessExpiresIn = expireIn, - RefreshToken = GenerateRefreshToken(), + RefreshToken = newRefreshToken, RefreshExpiresIn = DateTime.UtcNow.Add(Lifetime) }; }