I did something similar when each user will have their own unique token. I created a UserProfile to store the token:
from django.contrib.auth.models import User class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) token = models.CharField(max_length=100, blank=True)
The idea is to log in to a Django user as indicated in the document. After successful user authentication, create or update a UserProfile to save the token you receive from the WS WS call, or another WS that will return a unique token to you.
While the current user is authenticated, you can use the saved token to call another WS.
In your settings.py :
AUTH_PROFILE_MODULE = 'userprofiles.userprofile'
From the view code, it looks something like this:
request.user.get_profile().token
source share