0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00

Fix find_key_with_source (2231571657) (#3429)

This commit is contained in:
Paolo D'Amico 2021-02-22 13:27:09 -06:00 committed by GitHub
parent a65e7c83b9
commit 8cf616643c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,11 +34,9 @@ class PersonalAPIKeyAuthentication(authentication.BaseAuthentication):
authorization_match = re.match(fr"^{cls.keyword}\s+(\S.+)$", request.META["HTTP_AUTHORIZATION"])
if authorization_match:
return authorization_match.group(1).strip(), "Authorization header"
if request_data is None and isinstance(request, Request):
data = request.data
else:
data = request_data or {}
if "personal_api_key" in data:
data = request.data if request_data is None and isinstance(request, Request) else request_data
if data and "personal_api_key" in data:
return data["personal_api_key"], "body"
if "personal_api_key" in request.GET:
return request.GET["personal_api_key"], "query string"