discolabs / django-shopify-auth

A package for adding Shopify authentication to a Django app.
MIT License
144 stars 52 forks source link

Authentication error in Django 1.10+ #39

Closed ckepper closed 6 years ago

ckepper commented 6 years ago

The lib works fine in Django 1.9 but I can't get it to work in Django 1.10+. When trying to install an app, I get the following error message in the authenticate step: TypeError: authenticate() missing 1 required positional argument: 'request'

Full stack trace:

Internal Server Error: /accounts/login/
Traceback (most recent call last):
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/shopify_auth/views.py", line 24, in login
    return authenticate(request, *args, **kwargs)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/shopify_auth/views.py", line 36, in authenticate
    return finalize(request, token='00000000000000000000000000000000', *args, **kwargs)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/shopify_auth/views.py", line 69, in finalize
    user = auth.authenticate(myshopify_domain=shopify_session.url, token=shopify_session.token)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 70, in authenticate
    user = _authenticate_with_backend(backend, backend_path, request, credentials)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 115, in _authenticate_with_backend
    return backend.authenticate(*args, **credentials)
  File "/Users/kepper/.pyenv/versions/3.6.1/envs/shopify/lib/python3.6/site-packages/shopify_auth/backends.py", line 10, in authenticate
    user = super(ShopUserBackend, self).authenticate(remote_user=myshopify_domain)
TypeError: authenticate() missing 1 required positional argument: 'request'
[23/Nov/2017 22:20:27] "POST /accounts/login/?next=/ HTTP/1.1" 500 105165
gavinballard commented 6 years ago

@ckepper This should be fixed in v0.7.0 of the package, which I've just released to PyPi.

/cc @Benoss

ckepper commented 6 years ago

Wow! That was quick. Thanks a lot 👍