You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
classTokenAuthSupportQueryString(TokenAuthentication):
""" Extend the TokenAuthentication class to support querystring authentication in the form of "http://www.example.com/?auth_token=<token_key>" """defauthenticate(self, request):
# Check if 'token_auth' is in the request query params.# Give precedence to 'Authorization' header.if'auth_token'inrequest.QUERY_PARAMSand \
'HTTP_AUTHORIZATION'notinrequest.META:
returnself.authenticate_credentials(request.QUERY_PARAMS.get('auth_token'))
else:
returnsuper(TokenAuthSupportQueryString, self).authenticate(request)
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
Subclass TokenAuthentication to check querystring or header.
Update the RequestLogMiddleware class to check the querystring for a token.
Additional Context
Optional. Add any other context, screenshots, gifs, etc about the feature request here.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Draft
This is a draft issue, and it will need to clarify specs and formalize what
counts as "done" before work begins on it.
Check with the issue's creator before starting work on this issue.
Overview
Solves 2 issues:
TokenAuthentication
and django-rest-swaggar SECURITY_DEFINITIONS type 'apiKey' isn't compatible withrest_framework.authentication.TokenAuthentication
marcgibbons/django-rest-swagger#660This SO answer has an example of subclassing
TokenAuthentication
to support both query string and header. https://stackoverflow.com/a/29435607Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
TokenAuthentication
to check querystring or header.RequestLogMiddleware
class to check the querystring for a token.Additional Context
Optional. Add any other context, screenshots, gifs, etc about the feature request here.
The text was updated successfully, but these errors were encountered: