Skip to content

Instantly share code, notes, and snippets.

@ph00lt0
Created May 12, 2020 20:14
Show Gist options
  • Save ph00lt0/208432ff6da9d2832d7437e6251d10b6 to your computer and use it in GitHub Desktop.
Save ph00lt0/208432ff6da9d2832d7437e6251d10b6 to your computer and use it in GitHub Desktop.
Force authenticated Django Rest Framework
user = User.objects.get(username='lauren')
client = APIClient()
client.force_authenticate(user=user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment