I've copied the full sqlalchemy example from the fastapi-users docs with postgresql+asyncpg and I have something working, but I'm not sure if I'm using it correctly with Google.
In the swagger UI I am able to use the Authorize form successfully and I can see fastapi reports "POST /auth/jwt/login HTTP/1.1" 200 OK.
I am trying to understand the order of endpoints being used in this authorization process. So in parallel I am using the swagger UI to execute the following steps:
- Post to
/auth/jwt/login. This returns{"access_token": <some_token>, "token_type": "bearer"}. - Post to
/auth/request-verify-tokenand although in swagger the response body isnull, the fastapi logs showVerification requested for user 8d1c6256-c988-446d-b726-77ba934ceb5b. Verification token: <some_token>followed by"POST /auth/request-verify-token HTTP/1.1" 202 Accepted. - Post to
/auth/verifywith the token from step 2, which returns"POST /auth/verify HTTP/1.1" 200 OKand the user info.
Is this the correct order of events? At what point does google come into play? I do not see any google endpoints being hit (/auth/google/authorize and /auth/google/callback). If I want to use google, do I need to modify the prefix in get_auth_router() or do I need to modify the full example in any way?
app.include_router(
fastapi_users.get_auth_router(auth_backend), prefix="/auth/jwt", tags=["auth"]
)
Also, why are there 2 tables in the DB (user and oauth_account). I can see my google user in user but the oauth_account table is empty. Should both tables have been filled out?