Response format of ejabberd_auth_http for authentication

I am trying to use ejabberd_auth_http module for user authentication in ejabberd server. Hence, for authentication, ejabberd server will make a query to django rest server and check if the user exist with provided credentials.

When I am trying to login in the ejabberd web admin (192.168.43.16:5280) with username (772@198.168.43.16) and password (token) it failed to login. The log is

19:27:27.541 [debug] Making request 'check_password' for user 772@192.168.43.16...
19:27:27.573 [debug] Request result: 200: <<>>
19:27:27.573 [debug] Making request 'user_exists' for user 772@192.168.43.16...
19:27:27.590 [debug] Request result: 200: <<>>
19:27:27.590 [warning] Access of <<"772@192.168.43.16">> from <<"192.168.43.115">> failed with error: <<"inexistent-account">>

However, status code of the response from the django rest server is 200 and the response is 'true' when I am using the same url in the web browser. The following is the code snippet of django view.

@api_view(['GET'])
@permission_classes([AllowAny])
@authentication_classes([])
def user_exists(request):
user = request.query_params.get("user")
if request.query_params.get("server"):
user+='@'+request.query_params.get("server")
print(user)
try:
User.objects.get(username=user)
return HttpResponse("true")
except User.DoesNotExist:
raise exceptions.NotFound('false')

@api_view(['GET'])
@permission_classes([AllowAny])
@authentication_classes([])
def check_password(request):
try:
print(request.query_params)
password = request.query_params.get("pass")
Token.objects.get(key=password)
return HttpResponse('true')
except Token.DoesNotExist:
raise exceptions.AuthenticationFailed('false')

Syndicate content