diff --git a/ydb/library/login/login.cpp b/ydb/library/login/login.cpp index 403e2502f0ed..4c225e8f4691 100644 --- a/ydb/library/login/login.cpp +++ b/ydb/library/login/login.cpp @@ -389,12 +389,15 @@ TLoginProvider::TValidateTokenResponse TLoginProvider::ValidateToken(const TVali auto keyId = FromStringWithDefault(decoded_token.get_key_id()); const TKeyRecord* key = FindKey(keyId); if (key != nullptr) { + static const size_t ISSUED_AT_LEEWAY_SEC = 2; auto verifier = jwt::verify() - .allow_algorithm(jwt::algorithm::ps256(key->PublicKey)); + .allow_algorithm(jwt::algorithm::ps256(key->PublicKey)) + .issued_at_leeway(ISSUED_AT_LEEWAY_SEC); if (Audience) { // jwt.h require audience claim to be a set verifier.with_audience(std::set{Audience}); } + verifier.verify(decoded_token); response.User = decoded_token.get_subject(); response.ExpiresAt = decoded_token.get_expires_at();