Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User token is not refreshed with autoRefreshTokens when invalidated by Magento backend #3151

Closed
3 tasks
nikblack opened this issue Jun 27, 2019 · 9 comments
Closed
3 tasks
Labels
3: Medium complexity bug Bug reports QA approved after merge Testers will add this label after positive check on merged changes vs-hackathon Tasks for the Hackathon
Milestone

Comments

@nikblack
Copy link

nikblack commented Jun 27, 2019

Current behavior

When user token is invalidated by Magento backend, refresh logic is not working in /core/lib/sync/task.ts

The error returned by Magento is:
{"code":500,"result":"The consumer isn't authorized to access self."}

The check if token is invalidated looks like:
resultString.indexOf('not authorized')) >= 0

So now it is not passed as 'not authorized' !== ' isn't authorized'

Expected behavior

If user token is invalid and autoRefreshTokens === true, user token should be refreshed

Steps to reproduce the issue

  1. Create user account
  2. Wait timeout to user token invalidated on Magento Backend
  3. Reload application home page

Repository

Can you handle fixing this bug by yourself?

  • [+] YES
  • NO

Which Release Cycle state this refers to? Info for developer.

Pick one option.

  • This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from develop branch and create Pull Request 2. Feature / Improvement back to develop.
  • This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from release branch and create Pull Request 3. Stabilisation fix back to release.
  • [ +] This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from hotfix or master branch and create Pull Request 4. Hotfix back to hotfix.

Environment details

  • Browser: Chrome Version 75.0.3770.100
  • OS: MacOS 10.13.6
  • Node: 11.3.0
  • Code Version: master

Additional information

@nikblack nikblack added the bug Bug reports label Jun 27, 2019
@pkarw pkarw added vs-hackathon Tasks for the Hackathon 3: Medium complexity labels Jun 28, 2019
@pkarw pkarw added this to the 1.10.0 milestone Jun 29, 2019
@pkarw pkarw mentioned this issue Jul 4, 2019
5 tasks
@pkarw
Copy link
Collaborator

pkarw commented Jul 6, 2019

Related: vuestorefront/vue-storefront-api#297

pkarw added a commit that referenced this issue Jul 16, 2019
@pkarw pkarw closed this as completed Jul 16, 2019
pkarw added a commit that referenced this issue Jul 16, 2019
@alinadivante
Copy link
Collaborator

@patzick after refreshing the page, the user is logged out. Please fix it :)

@alinadivante alinadivante reopened this Aug 8, 2019
@alinadivante alinadivante added the QA rejected Testers will add this label when something is still wrong label Aug 8, 2019
@pkarw
Copy link
Collaborator

pkarw commented Aug 8, 2019

@alinadivante are you usune the most current vsapi? It could have not yet been fixed to demo instance: I mean the fix for http status codes which is related to that one

@patzick patzick added QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. and removed QA rejected Testers will add this label when something is still wrong labels Aug 8, 2019
@patzick
Copy link
Collaborator

patzick commented Aug 8, 2019

Fixed with #3342 :) please retest

@patzick patzick closed this as completed Aug 8, 2019
@alinadivante
Copy link
Collaborator

@patzick ! We forgot about this PR #3271
and this one resolves problem, which I mentioned here #3237

When I change manually token in dev console (shop/user/current-token) and open again my account and refresh page - there is info "Consumer is not authorized to access self" but user is still logged in.

and it resolves also this issue: #3343 :)

I think #3271 should be merged to release/v.1.10

@patzick
Copy link
Collaborator

patzick commented Aug 9, 2019

@alinadivante closed in #3345, ported this fix from 1.11
please retest :)

@alinadivante
Copy link
Collaborator

ok, for now it is okay, but sometimes, when user opens the page using URL, than "Consumer is not authorized to access self" message appears (user is still logged in). We should improve this in v1.11

@alinadivante alinadivante added QA approved after merge Testers will add this label after positive check on merged changes and removed QA - Ready for tests This is notification for testers, that improvement is ready to be tested and verified. labels Aug 9, 2019
@undefinederror
Copy link
Contributor

Hey, this has definitely not been fixed.
Once the token expires it never gets refreshed.
"Consumer is not authorized to access self" on each and every refresh after that

@undefinederror
Copy link
Contributor

oooooo I see...
It has been fixed in vuestorefront/magento2-rest-client@fb5adcb

I had to upgrade that dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Medium complexity bug Bug reports QA approved after merge Testers will add this label after positive check on merged changes vs-hackathon Tasks for the Hackathon
Projects
None yet
5 participants