diff --git a/plugins/auth/fps_auth/backends.py b/plugins/auth/fps_auth/backends.py index e670cb8c..0a3882ca 100644 --- a/plugins/auth/fps_auth/backends.py +++ b/plugins/auth/fps_auth/backends.py @@ -114,7 +114,7 @@ def get_jwt_strategy() -> JWTStrategy: class UserManager(UUIDIDMixin, BaseUserManager[User, uuid.UUID]): async def on_after_register(self, user: User, request: Optional[Request] = None): - for oauth_account in user.oauth_accounts: + for oauth_account in await user.awaitable_attrs.oauth_accounts: if oauth_account.oauth_name == "github": async with httpx.AsyncClient() as client: r = ( diff --git a/plugins/auth/fps_auth/db.py b/plugins/auth/fps_auth/db.py index a8c704b9..100f682f 100644 --- a/plugins/auth/fps_auth/db.py +++ b/plugins/auth/fps_auth/db.py @@ -11,7 +11,7 @@ SQLAlchemyUserDatabase, ) from sqlalchemy import JSON, Boolean, Column, String, Text -from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine +from sqlalchemy.ext.asyncio import AsyncAttrs, AsyncSession, async_sessionmaker, create_async_engine from sqlalchemy.orm import DeclarativeBase, Mapped, relationship from .config import _AuthConfig @@ -20,7 +20,7 @@ logger = logging.getLogger("auth") -class Base(DeclarativeBase): +class Base(AsyncAttrs, DeclarativeBase): pass