Repository: saleor/saleor

Issue:
graphql_jwt.exceptions.PermissionDenied: You do not have permission to perform this action
### I want to deploy full saleor store(saleor/saleor-dashboard/saleor-storefront) with docker but i catught and expection that means have no permissn to query in graphql api and storefront cant load the main site.
…

### Steps to reproduce the problem
1. git clone https://github.com/mirumee/saleor.git
2. cd saleor
3. docker-compose build
4. And continue to see in accordance with the documentation
![Screenshot from 2019-12-25 16-32-56](https://user-images.githubusercontent.com/22658149/71446013-405f6e00-2734-11ea-8e1c-04d57c7df0ab.png)

### What I expected to happen
load normally the site like before.

### Screenshots
![Screenshot from 2019-12-25 16-28-55](https://user-images.githubusercontent.com/22658149/71445965-dd6dd700-2733-11ea-9fc0-c9e76c8f3595.png)

**System information**
Operating system:
ubuntu 18:04


Discussion:
@ehsanbarkhordar Hi there! Due to the holiday season, our support is limited. We'll try to help you as soon as we can. Thanks for understanding. 
@ehsanbarkhordar Hey! Did you prepare the database? https://docs.saleor.io/docs/getting-started/docker/#how-to-use-docker
I had this issue too. Opening a private browsing window or clearing cookies resolved it for me. So I think it's something to do with failed JWT credentials from previous sessions getting stored and not expiring?
Hello,

Any idea how to fix this please ? 
@thewjones your tips works sometimes not all... :-(

Thanks for help.

Regards
I have the same issue
@tboulogne @closelookadmin Could you please tell me all the steps you have taken? We need more details. It will help us to reproduce the issue. 
facing the same issue when adding attributes to any particular product. Although as mentioned by @thewjones the issue can be resolved by opening private window. But this should not happen as there is no way users of the store going to open the store in private window :)
@devyog It might be related to apollo cache. We need to know all the steps you have taken, and we'll try to reproduce it. 

Resolving patch:
diff --git a/saleor/graphql/account/schema.py b/saleor/graphql/account/schema.py
--- a/saleor/graphql/account/schema.py
+++ b/saleor/graphql/account/schema.py
@@ -1,5 +1,4 @@
 import graphene
-from graphql_jwt.decorators import login_required
 
 from ...core.permissions import AccountPermissions
 from ..core.fields import FilterInputConnectionField
@@ -208,9 +207,9 @@ def resolve_permission_groups(self, info, query=None, **kwargs):
     def resolve_permission_group(self, info, id):
         return graphene.Node.get_node_from_global_id(info, id, Group)
 
-    @login_required
     def resolve_me(self, info):
-        return info.context.user
+        user = info.context.user
+        return user if user.is_authenticated else None
 
     @permission_required(AccountPermissions.MANAGE_STAFF)
     def resolve_staff_users(self, info, query=None, **kwargs):


Test patch:
diff --git a/tests/api/test_account.py b/tests/api/test_account.py
--- a/tests/api/test_account.py
+++ b/tests/api/test_account.py
@@ -466,7 +466,8 @@ def test_me_query(user_api_client):
 
 def test_me_query_anonymous_client(api_client):
     response = api_client.post_graphql(ME_QUERY)
-    assert_no_permission(response)
+    content = get_graphql_content(response)
+    assert content["data"]["me"] is None
 
 
 def test_me_query_customer_can_not_see_note(
diff --git a/tests/api/test_graphql.py b/tests/api/test_graphql.py
--- a/tests/api/test_graphql.py
+++ b/tests/api/test_graphql.py
@@ -50,7 +50,6 @@ def test_jwt_middleware(client, admin_user):
     repl_data = response.json()
     assert response.status_code == 200
     assert isinstance(response.wsgi_request.user, AnonymousUser)
-    assert "errors" in repl_data
     assert repl_data["data"]["me"] is None
 
     # test creating a token for admin user
diff --git a/tests/api/test_wishlist.py b/tests/api/test_wishlist.py
--- a/tests/api/test_wishlist.py
+++ b/tests/api/test_wishlist.py
@@ -195,7 +195,8 @@ def test_wishlist_get_items_from_anonymous_user(api_client):
     }
     """
     response = api_client.post_graphql(query)
-    assert_no_permission(response)
+    content = get_graphql_content(response)
+    assert content["data"]["me"] is None
 
 
 def test_wishlist_get_items_from_logged_user(user_api_client, customer_wishlist_item):