-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I have a case where an API can be accessed both with or without authentication, i.e., reduced access and capability without authentication, but with full features with authentication. This seems to be tricky to get done with the current token_auth though. It will check that
Authorizationheader exists, if not, 401- The introspection succeeds, if not, 403
I looked at #161 but it doesn't seem to address this. What I'd like is a way to programmatically check if token is supplied and it is valid or not. The introspect_token looked promising, but it will balk on a missing Authorization header.
I settled for the time being to wrap the token_auth decorator so I can intercept 401/403 if they occur and then bypass to the actual view function, but this is quite a kludge.
Since #161 is deprecating introspect_token, it doesn't seem to be a good choice anyway. Would it be possible to expose functionalities of the decorators directly or have a required=False keyword option for them?