INNER CODE UNIT · Python

_refresh_auth_token

hunvreus/devpush · app/dependencies.py:223

def _refresh_auth_token(
    request: Request,
    settings: Settings,
    user_id: int,
    expires_at: datetime,
):
    if settings.auth_token_refresh_threshold_days <= 0:
        return
    refresh_threshold = timedelta(days=settings.auth_token_refresh_threshold_days)
    if expires_at - utc_now() > refresh_threshold:
        return
    now = utc_now()
    new_exp = now + timedelta(days=settings.auth_token_ttl_days)
    new_token = jwt.encode(
        {"alg": "HS256"},
        {
            "sub": user_id,
            "type": "auth_token",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…