Skip to content

Instantly share code, notes, and snippets.

View RockingRolli's full-sized avatar

Roland von Ohlen RockingRolli

View GitHub Profile
@RockingRolli
RockingRolli / authentication.py
Last active November 28, 2019 09:19
DRF token auth with mongoengine
from rest_framework.authentication import TokenAuthentication
from .models import MongoToken
from rest_framework import exceptions
class MongoTokenAuthentication(TokenAuthentication):
model = MongoToken
def authenticate_credentials(self, key):
try: