Replies: 1 comment
-
You should inherit from CookieTransport and override its methods instead of modifying the original source code. class MyCookieTransport(CookieTransport):
@staticmethod
def get_openapi_login_responses_success() -> OpenAPIResponseType:
...
async def get_login_response(self, token: str) -> Response:
response = Response(status_code=..., content=...)
return self._set_login_cookie(response, token)
cookie_transport = MyCookieTransport(cookie_max_age=3600)
auth_backend = AuthenticationBackend(
transport=cookie_transport,
...,
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to connect FastUI and fastapi-users.
I added all the example data from the documentation, but whenever I try to log in, I get a 204 No Content response. I need to return some data in a custom format from the response instead.
In the cookie transport, I modified the get_logout_response and get_login_response methods to return my custom format:
I also added the response parameter to the login function in the auth.py router:
I think it's not a good idea to modify the library code just to make my own code work. After all, when a new version is released, I'll have to reapply all my changes again.
Beta Was this translation helpful? Give feedback.
All reactions