workos-python icon indicating copy to clipboard operation
workos-python copied to clipboard

refresh_session `token is not yet valid`

Open Dhruv-Maradiya opened this issue 4 months ago • 0 comments

I am using workos authkit and after refreshing the session result.authenticated is false and reason is The token is not yet valid (iat).

Issue only appears after refreshing the session.

Python Version: 3.12.11 Workos SDK: 5.26.1

Let me know if more context is needed.

refresh_result = await session.refresh(
    cookie_password=settings.WORKOS_COOKIE_PASSWORD
)

if not refresh_result.authenticated:
    # Authentication failed, even after refresh
    auth_logger.warning(
        f"Authentication failed even after refresh with reason: {refresh_result.reason}"  # type: ignore[reportOptionalMemberAccess]
    )
    return {}, None

Dhruv-Maradiya avatar Aug 19 '25 13:08 Dhruv-Maradiya