title: DFR simple jwt get authToken from a user instance instead of username/password
body: <p>I have a simple chat app, authentication in it works exaclty as whatsapp</p>
  <p>Get phone number =&gt; if doesn't exist create one else skip =&gt; send validation code and set it as &quot;phone_code&quot; field in User model =&gt; finally remove the &quot;phone_code&quot; if validated</p>
  <p>The app is built in React Native with Rest framework as the API, I'm new to this and I'm struggling to get the authentication token without the password. i use djangorestframework-simplejwt</p>
  <p>my register view:</p>
  <pre><code>@api_view(('POST',))
  def register(request):
      if request.method == 'POST':
          serializer = UserSerializer(data=request.data)
          if not serializer.is_valid():
              if 'is not valid' in serializer.errors['phone_number'][0]:
                  return Response(serializer.errors, status.HTTP_400_BAD_REQUEST)
          phone_number = serializer.initial_data['phone_number'].replace(' ', '')
          try:
              user = User.objects.get(phone_number=phone_number)
          except User.DoesNotExist:
              user = User.objects.create_user(
                  phone_number=phone_number, username=phone_number)
          user.phone_code = randint(99999, 999999)
          user.save()
          TokenObtainPairView()
          return Response(serializer.data, status.HTTP_200_OK)
          # todo send validation code, I will handle later
  </code></pre>
  <p>my Login view (Chich validates for the validation code)</p>
  <pre><code>@api_view(['POST',])
  def loginuser(request):
      if request.method == 'POST':
          phone_number = request.data.get('phone_number')
          try:
              user = User.objects.get(phone_number=phone_number)
              if int(request.data.get('phone_code')) == user.phone_code and user.phone_code:
                  user.phone_code = None
                  user.save()
                  #!!!!!!!!!!!!!!!!!!!NOW HOW CAN I GET THE JWT AUTHENTICATION TOKEN AND SEND IT TO MY REACT NATIVE APP?!
                  return JsonResponse({'phone_number': phone_number}, status=200)
  
              else:
                  return JsonResponse({'error': &quot;Invalid code&quot;}, status=400)
          except Exception as error:
                  return JsonResponse({'error': error}, status=500)
  </code></pre>
  <p>when the user validates his phonenumber, how can I send the jwt format auth token with the Response?</p>
  <p>urls.py:</p>
  <pre><code>path('api/token/', users_views.ObtainToken.as_view(), name='token_obtain_pair'),
  </code></pre>
  <p>my Custom obtainToken view:</p>
  <pre><code>class ObtainToken(TokenObtainPairView):
      permission_classes = (AllowAny,)
      serializer_class = MyTokenObtainPairSerializer
  </code></pre>
  <p>Also I found out that when I was using Postman if I send an empty password the system will give a the authentication token. I would appreciate any help, thanks</p>