saleor / saleor-storefront

A GraphQL-powered, NextJs-based, PWA storefront for Saleor. IMPORTANT: This project is [DEPRECATED] in favor of saleor/react-storefront soon to become our default demo and storefront starter pack.
https://demo.saleor.io/
BSD 3-Clause "New" or "Revised" License
770 stars 672 forks source link

graphql_jwt.exceptions.JSONWebTokenError: Error decoding signature after deploying on Nginx #1031

Closed Suryaphalle closed 3 years ago

Suryaphalle commented 3 years ago

What I'm trying to achieve

I was trying to deploy saleor dashboard and storefront using nginx. Successfully deployed Django server and stroefront server and dashboard server, but facing bellow issue while loggin into dasbhoard. On npm start everything works normally but from nginx facing this issue.

Steps to reproduce the problem

dasbhoiard nginx conf

server {
    listen 9000;
    server_name  localhost;
    root   /home/user/projects/MB365/salaor/saleor-dashboard/build/dashboard/;
    location / {
        try_files $uri $uri/ /index.html$args;
    }
}

django nginx conf file:

server {
    listen 8000;
    server_name  127.0.0.1;
    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/user/projects/MB365/salaor/saleor_core/saleor;
    }
    location / {
        include proxy_params;
        proxy_pass http://unix:/home/user/projects/MB365/salaor/saleor_core/mysite.sock;
    }
}

build is created and able run on specific port

Screenshot from 2021-04-21 14-17-34

after entering credentials it take me to home page, but when I try access product list or any other pages my JWT session get expired

Screenshot from 2021-04-21 14-19-47

Error on error.log

Traceback (most recent call last): File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql/execution/executor.py", line 452, in resolve_or_error return executor.execute(resolve_fn, source, info, *args) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql/execution/executors/sync.py", line 16, in execute return fn(args, kwargs) File "/home/user/projects/MB365/salaor/saleor_core/saleor/graphql/middleware.py", line 59, in app_middleware return next(root, info, kwargs) File "/home/user/projects/MB365/salaor/saleor_core/saleor/graphql/middleware.py", line 23, in resolve return super().resolve(next, root, info, kwargs) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/middleware.py", line 72, in resolve user = authenticate(request=context, kwargs) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/django/contrib/auth/init.py", line 72, in authenticate user = backend.authenticate(request, **credentials) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/backends.py", line 14, in authenticate return get_user_by_token(token, request) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/shortcuts.py", line 20, in get_user_by_token payload = get_payload(token, context) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/utils.py", line 90, in getpayload raise exceptions.JSONWebTokenError(('Error decoding signature')) graphql_jwt.exceptions.JSONWebTokenError: Error decoding signature ERROR saleor.graphql.errors.handled A query had an error [PID:1385:MainThread] Traceback (most recent call last): File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/utils.py", line 86, in get_payload payload = jwt_settings.JWT_DECODE_HANDLER(token, context) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/utils.py", line 45, in jwt_decode return jwt.decode( File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/jwt/api_jwt.py", line 91, in decode decoded = super(PyJWT, self).decode( File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/jwt/api_jws.py", line 155, in decode self._verify_signature(payload, signing_input, header, signature, File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/jwt/api_jws.py", line 223, in _verify_signature raise InvalidSignatureError('Signature verification failed') jwt.exceptions.InvalidSignatureError: Signature verification failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql/execution/executor.py", line 452, in resolve_or_error return executor.execute(resolve_fn, source, info, *args) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql/execution/executors/sync.py", line 16, in execute return fn(args, kwargs) File "/home/user/projects/MB365/salaor/saleor_core/saleor/graphql/middleware.py", line 59, in app_middleware return next(root, info, kwargs) File "/home/user/projects/MB365/salaor/saleor_core/saleor/graphql/middleware.py", line 23, in resolve return super().resolve(next, root, info, kwargs) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/middleware.py", line 72, in resolve user = authenticate(request=context, kwargs) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/django/contrib/auth/init.py", line 72, in authenticate user = backend.authenticate(request, **credentials) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/backends.py", line 14, in authenticate return get_user_by_token(token, request) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/shortcuts.py", line 20, in get_user_by_token payload = get_payload(token, context) File "/home/user/projects/MB365/mbenv/lib/python3.8/site-packages/graphql_jwt/utils.py", line 90, in getpayload raise exceptions.JSONWebTokenError(('Error decoding signature')) graphql_jwt.exceptions.JSONWebTokenError: Error decoding signature

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.