magento-lts icon indicating copy to clipboard operation
magento-lts copied to clipboard

Fixed incorrect OAuth nonce_used error when it should be error on inc…

Open kiatng opened this issue 1 year ago • 4 comments

…orrect consumer key.

Description (*)

Incorrect error message leads the developer astray and can waste hours on the wrong thing. This PR fixes such a bug.

Manual testing scenarios (*)

I use openmage-shooter to test.

  1. [OpenMage OAuth Server] Add a consumer if none exist.
  2. [DDEV] Install openmage-shooter in your DDEV environment.
  3. [Browser] Open https://openmage.ddev.site/shooter/rest
    • Fill in the OAuth params, on Consumer Key, enter a wrong key.
    • Click save.
    • Error nonce_used: image
    • Try again with this PR, error: Could not retrieve a valid Token response from Token URL: oauth_problem=consumer_key_rejected

kiatng avatar Nov 24 '24 02:11 kiatng

Tried and failed ...

  • install your module
  • added oauth consumer
  • went to "shooter/rest"
  • got redirected to customer login
  • logged in
  • "shooter/rest/index" shows 404

sreichel avatar Jan 17 '25 19:01 sreichel

Tried and failed ...

  • install your module
  • added oauth consumer
  • went to "shooter/rest"
  • got redirected to customer login
  • logged in
  • "shooter/rest/index" shows 404

Did you add your OAuth consumer in the same OpenMage instance? Test the API to itself? I do not think this can work. I used the session to store OAuth token, if you login in to authorize, the session is lost Can you test the API with another OpenMage instance?

After installing openmage-shooter, the normal steps in the browser are:

  1. Login to frontend, your customer ID must be <20 to access shooter
  2. Access "shooter/rest"
  3. Input URL other than local
  4. Redirected to server for authorization with email/password
  5. Redirect back to "shooter"
  6. Start the API test

kiatng avatar Jan 22 '25 07:01 kiatng