discolabs / django-shopify-auth

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

1.0.1 Missing ua_parser module + package doesn't work on Safari or Chrome #64

Closed nkbelow closed 3 years ago

nkbelow commented 3 years ago

Hello, I am trying to update to the new version 1.0.1 but it looks like the ua-parser module is not being included in requirements.txt. Even after installing ua-parser module locally, the users of my app cannot get around the third party cookie check on Chrome and Safari. Firefox seems to work though.

Traceback:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Users/nicholasbelow/tatari-shopify-app/.venv/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 45, in get_internal_wsgi_application
    return import_string(app_path)
  File "/Users/nicholasbelow/tatari-shopify-app/.venv/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/nicholasbelow/tatari-shopify-app/tatari_shopify/wsgi.py", line 19, in <module>
    application = get_wsgi_application()
  File "/Users/nicholasbelow/tatari-shopify-app/.venv/lib/python3.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
    return WSGIHandler()
  File "/Users/nicholasbelow/tatari-shopify-app/.venv/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 127, in __init__
    self.load_middleware()
  File "/Users/nicholasbelow/tatari-shopify-app/.venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 40, in load_middleware
    middleware = import_string(middleware_path)
  File "/Users/nicholasbelow/tatari-shopify-app/.venv/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/nicholasbelow/tatari-shopify-app/.venv/lib/python3.7/site-packages/shopify_auth/cookies_middleware.py", line 2, in <module>
    from ua_parser import user_agent_parser
ModuleNotFoundError: No module named 'ua_parser'
nkbelow commented 3 years ago

I've been trying to find a workaround for Safari and Chrome. Even though the a_third_party_cookie is being set, the package is not able to read its value in the is_cookie_present = request.COOKIES.get(THIRD_PARTY_COOKIE_NAME, 'false') check in the check_cookie view

stlk commented 3 years ago

Thanks for letting me know about missing ua-parser. Will fix it soon.

Regarding Safari and Chrome. I think your browser might be blocking 3rd party cookies. Here's more about the situation https://github.com/Shopify/shopify_app/issues/769

nkbelow commented 3 years ago

Ahh yes thanks for that link! It looks like this indeed is a 3rd party cookies issue. Appreciate all of your hard work on this project!