Skip to content
Snippets Groups Projects
Verified Commit e4c04463 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fixed 500 error in authentication

parent 3753193c
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ from rest_framework import exceptions
from rest_framework_jwt.settings import api_settings
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
from funkwhale_api.users.models import User
class TokenHeaderAuth(BaseJSONWebTokenAuthentication):
......@@ -40,7 +41,7 @@ class TokenAuthMiddleware:
auth = TokenHeaderAuth()
try:
user, token = auth.authenticate(scope)
except exceptions.AuthenticationFailed:
except (User.DoesNotExist, exceptions.AuthenticationFailed):
user = AnonymousUser()
scope['user'] = user
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment