Allow using query params to fetch GraphQL

This commit is contained in:
inexcode 2022-08-23 00:06:12 +04:00
parent aafc77dce3
commit ba434f4fb5

View file

@ -13,8 +13,9 @@ class IsAuthenticated(BasePermission):
message = "You must be authenticated to access this resource."
def has_permission(self, source: typing.Any, info: Info, **kwargs) -> bool:
return is_token_valid(
info.context["request"]
.headers.get("Authorization", "")
.replace("Bearer ", "")
)
token = info.context["request"].headers.get("Authorization")
if token is None:
token = info.context["request"].query_params.get("token")
if token is None:
return False
return is_token_valid(token.replace("Bearer ", ""))