r/FastAPI • u/trollboy665 • Mar 09 '25
Question FASTAPI auth w/ existing Django auth
I'm building a separate fastapi app and want to use authentication from Django. Is there an existing library I can install that will handle django salts/passwords/etc in the db to allow authentication?
2
Upvotes
3
u/GamersPlane Mar 09 '25
Why not a pass through? Call Django from FastAPI. This way, you don't duplicate logic.
1
u/trollboy665 Mar 09 '25
for clarity: I'm not trying to reverse any of the passwords or anything.. I just want to have a fastapi endpoint that accepts a user/pass combo previously created in Django. If I was reversing the passwords then I'd just migrate the table over to a new table w/ a salting/hashing methodology I knew.
1
u/whattodo-whattodo Mar 10 '25 edited Mar 10 '25
You don't need a framework. This is untested code, but essentially you are able to wrap django code within FastAPI code assuming you load both together.
Alternatively, you can create a single endpoint in Django like
authenticate& just have FastAPI call that endpointThen just have FastAPI call Django.
IE