FastAPI != FastHTML (idiomatic), even if both are based on Starlette and built on similar arch vision.
Go for idiomatic OAuth with FastHTML: https://github.com/AnswerDotAI/fasthtml-example/tree/main/oauth_example, read the doc https://www.fastht.ml/docs/explains/oauth.html