dimaportenko / magento-react-native

React Native mobile app for Magento 2.x
MIT License
297 stars 158 forks source link

unable to retrieve current customer Error: The consumer isn't authorized to access self #142

Closed iMohamedSamir closed 4 years ago

iMohamedSamir commented 4 years ago

Describe the bug The app failed to load categories in the homepage.

Expected behavior load categories in the homepage.

Current Behavior The app failed to load categories in the homepage.

Steps to Reproduce Please provide detailed steps for reproducing the issue.

  1. open app
  2. login
  3. press r to open debugger
  4. open inspector console
  5. reload the app
  6. See error

Screenshots

S8guX3O

Smartphone (please complete the following information):

Additional context I think this issue is not related to magento-react-native specifically, but I am still digging. Also it is not permission related issue, I sure I gave all access to the access token account.

dimaportenko commented 4 years ago

Hi @iMohamedSamir,

The error on your screenshot isn't related to the admin token in your config file. It's related to the customer token you get after login. But I don't think it somehow breaks your home screen.

  1. Did your categories load fine before you did login?
  2. Share your home screen cms config.
sanjeevyadavIT commented 4 years ago

Hi @iMohamedSamir

By default, customer token generated when user login is valid for 1 hour. You can change these values from Admin by selecting Stores > Settings > Configuration > Services > OAuth > Access Token Expiration.

There, increase the customer token expiry time to 168hours(7 days) or according to your need

@troublediehard I would suggest you to add this steps in setup guide.

dimaportenko commented 4 years ago

Thanks, @alexakasanjeev, good point. But I want to note it doesn't relate to the reported issue

Describe the bug
The app failed to load categories in the homepage.

Expected behavior
load categories in the homepage.
iMohamedSamir commented 4 years ago

Yeah, my bad, I had completely two separate issues and I thought they were related And thanks @troublediehard @alexakasanjeev