Fastapi: Issue with docs Authorize button, gives 400 Bad Request in the security tutorial

Created on 7 Jul 2020  路  5Comments  路  Source: tiangolo/fastapi

https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/ or
https://fastapi.tiangolo.com/tutorial/security/oauth2-jwt/
When following either tutorial from above, a bad request is sent when clicking the localhost:8000/docs Authorize button using any username or password. Tried directly copying and pasting the code, the issue persists.

Environment

macOS
FastAPI 0.58.1
Python 3.7.7

question

All 5 comments

Hello @davidmckayv - I'm just trying out FastAPI myself. Have you installed python-multipart?

pip install python-multipart

Then try with user johndoe and password secret.

Wow, I somehow missed the comment wherein it states this must be installed due to Ouath2 using "form data" for sending the username and password. All set.

@davidmckayv I'm glad it helped!

Thanks for the help here @shahinrostami ! :clap: :bow:

Thanks for reporting back and closing the issue @davidmckayv :+1:

It's my pleasure @tiangolo . Thank you for the excellent work on FastAPI 馃コ

Was this page helpful?
0 / 5 - 0 ratings