Closed mtkgeek closed 1 year ago
I'm afraid thats not possible out of the box with the dependency however you could in theory use a middleware. If that doesn't work have a look at #91 for some suggestions on how to implement this behaviour.
Now available in the latest release. See here for an example.
Hi, great package. Is there a way to get the current user without throwing the NotAuthenticatedException. Just get the user or None in my case
Writing a custom auth_exception_handler doesn't cut it for me because it expects a callable to be returned so I can't return None. This might look trivial but in the case where I'm building a web app and my responses class are templates not jsonresponses so returning a jsonresponse also doesn't help because internally fastapi_login just returns that to the browser instead of passing that as a return value from calling
get_current_user
. What I'm saying in essence is when I callI should get a value for
user
from the above, whether that be a user object, None, Jsonresponse. Not currently where I only get a user or nothing else(an exception that I can't control or customize)