0š
Iām in a similar situation and seeing this error. For me the solution was to provide a value for the id
attribute of the custom User
class when creating the user object.
This allows the default login()
function to work as it provides the value for the required primary key attribute.
My backend now looks something like this:
class CustomBackend(BaseBackend):
def get_user(self, user_id):
user = [...] # API call to get user data
return CTUser(
id=user_id, # <- added this
username=user['cmsUserId'],
email=user['email'],
first_name=user['firstName'],
last_name=user['lastName'],
)
def authenticate(self, request, username=None, password=None, **kwargs):
userid = [...] # API call to authenticate and get user id
user = self.get_user(userid)
user.logintoken = password
return user
š¤frsc
Source:stackexchange.com