'Add the profile claim details to the JWT payload.'

def attach_profile_claim(self, payload):

    try:
        name = UserProfile.objects.get(user=self.user).name
    except UserProfile.DoesNotExist:
        name = None
    payload.update({'name': name, 'family_name': self.user.last_name, 'given_name': self.user.first_name, 'administrator': self.user.is_staff})
