fix: add key for save pre auth token

This commit is contained in:
Polianin Nikita 2024-05-29 04:57:44 +03:00
parent 47a57693f8
commit ac7bbde75e

View File

@ -16,7 +16,7 @@ public class PreAuthService(ICacheService cache)
private static string GeneratePreAuthToken() => Guid.NewGuid().ToString().Replace("-", "") +
GeneratorKey.GenerateString(16);
public async Task<PreAuthTokenResponse> CreateLoginTokenAsync(TokenRequest request, string userId, CancellationToken cancellation = default)
private static string GetPreAuthCacheKey(string fingerprint) => $"{fingerprint}_pre_auth_token";
{
var firstAuthToken = GenerateFirstAuthToken();
@ -29,7 +29,7 @@ public class PreAuthService(ICacheService cache)
};
await cache.SetAsync(
request.Fingerprint,
GetPreAuthCacheKey(request.Fingerprint),
JsonSerializer.SerializeToUtf8Bytes(loginStructure),
Lifetime,
cancellation);