From d2d25da9d136d886d7ecb248a90d386c6ede2729 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Fri, 13 Aug 2021 08:46:47 +0200 Subject: [PATCH] Fix OAuth2 documentation (#692) --- docs/configuration/oauth.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/configuration/oauth.md b/docs/configuration/oauth.md index 0eeb84b5..6ac7a7e1 100644 --- a/docs/configuration/oauth.md +++ b/docs/configuration/oauth.md @@ -71,16 +71,25 @@ Notice that we inherit from the `BaseOAuthAccountMixin`, which adds a `List` of You'll need to define the table for storing the OAuth account model. We provide a base one for this: ```py -from fastapi_users.db.sqlalchemy import SQLAlchemyBaseOAuthAccountTable +from fastapi_users.db import SQLAlchemyBaseOAuthAccountTable class OAuthAccount(SQLAlchemyBaseOAuthAccountTable, Base): pass ``` -Then, you should declare it on the database adapter: +Similarly, define the table for storing the User model: ```py -user_db = SQLAlchemyUserDatabase(UserDB, database, User.__table__, OAuthAccount.__table__) +from fastapi_users.db import SQLAlchemyBaseUserTable + +class UserTable(Base, SQLAlchemyBaseUserTable): + pass +``` + +Then, you should declare them on the database adapter: + +```py +user_db = SQLAlchemyUserDatabase(UserDB, database, UserTable.__table__, OAuthAccount.__table__) ``` #### MongoDB