from django.contrib.auth.backends import RemoteUserBackend


class ShopUserBackend(RemoteUserBackend):

    def authenticate(self, request=None, myshopify_domain=None, token=None, **kwargs):
        if not myshopify_domain or not token or not request:
            return

        user = super(ShopUserBackend, self).authenticate(request=request, remote_user=myshopify_domain)
        if not user:
            return

        user.token = token
        user.save(update_fields=['token'])
        return user

@@ -96,17 +96,16 @@
 ckend):%0A
-%0A
     def 
@@ -256,32 +256,49 @@
         return%0A%0A
+        try:%0A    
         user = s
@@ -385,16 +385,232 @@
 domain)%0A
+        except TypeError:%0A            #  Django %3C 1.11 does not have request as a mandatory parameter for RemoteUserBackend%0A            user = super(ShopUserBackend, self).authenticate(remote_user=myshopify_domain)%0A%0A
         

Add regression fix for Django < 1.11