Fastapi: [QUESTION] How can I make a general middleware for authentication?

Created on 2 Jul 2019  路  5Comments  路  Source: tiangolo/fastapi

How can I make a general middleware for authentication?
Is it possible to connect the middleware to a router or an endpoint?

question

Most helpful comment

This conversation is over a year old, please open a new issue.

All 5 comments

One place you can do this is at the include_router level. See an example using dependencies for a router here: https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter specifically the line dependencies=[Depends(get_token_header)],

Thanks for the idea!

Thanks for the help here @agundy ! :cake: :rocket:

Thanks @deterok for reporting back and closing the issue. :tada:

Is it possible to remove endpoint dependencies singly in this router?

This conversation is over a year old, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings