Search code examples
python-3.xauthenticationdjango-rest-frameworkjwtmicroservices

Is there a better way to verify tokens across services in djangoREST using django-simple-jwt


I have two Django backends hosted differently, one is an authentication service(ServiceA) that handles everything auth including generating tokens using the djangorest-simple-jwt library. The other is a service for my business logic(ServiceB). There is a route on the 'ServiceA' that verifies tokens which is token/verify. I currently verify tokens on 'ServiceB' before processing a request, by calling the token/verify on ServiceA which I think is not the optimal way to communicate between the two services. What better approach do you suggest.


Solution

  • Have you looked at JWTTokenUserAuthentication?

    This can facilitate developing single sign-on functionality between separately hosted Django apps which all share the same token secret key.