Skip to content
Discussion options

You must be logged in to vote

It turns out that I had "/schema" as an exclude path on my SessionAuth instance. I removed that and my approach above now seems to be working. The gist of it is simply to subclass OpenAPIController and provide it with whatever guards you would normally use on a controller for your authentication approach:

from litestar.openapi import OpenAPIController

class CustomDocController(OpenAPIController):
    guards = [myguard]

Then specify that as the openapi_controller on the OpenAPIConfig.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Goldziher
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants