-
I recreated the full example from the documentation. Now I am trying to switch the transport to a cookie transport (which seems to have worked) and the strategy to the database strategy (which is not working). After making a user and then trying to sign in results in this error:
It seems like there is a problem with the session returned from Here is a link to a repo with the bare bones code: https://github.com/NateXVI/fastapi-users-creating-session-error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I figured out the problem. I passed the - def get_db_strategy() -> DatabaseStrategy:
- return DatabaseStrategy(get_access_token_db, lifetime_seconds=3600)
+ def get_db_strategy(session=Depends(get_access_token_db)) -> DatabaseStrategy:
+ return DatabaseStrategy(session, lifetime_seconds=3600) |
Beta Was this translation helpful? Give feedback.
I figured out the problem. I passed the
get_access_token_db
function into theDatabaseStrategy
class, but I needed to pass the database session returned from the function instead.