Hello All,
I have a live Shopify App which was last updated 3 months ago, however new users are unable to install the application and get the error "The authorization code was not found or was already used"
The app is running:
rails 5.0.1
shopify_app (7.3.0)
omniauth-shopify-oauth2 (1.2.0)
The error appears during the Shopify callback to Omniauth
The 'code' is present, so I'm guessing that the code has already been used for some reason? I have seen this issue on Stackoverflow "https://stackoverflow.com/questions/42780268/error-generated-while-trying-to-create-shopify-access-token" but this case in different, I'm not doing any fancy redirecting.
Does anyone have any idea what could be causing this issue?
馃憢 @charlesemarsh Do you have any information when this error started to happen or has this always been happening?
Also is there a possibility that this link is being loaded twice? Like the solution of the SO issue you linked they were loading it once and pressing their back button. The access code is expired after viewed once so upon loading that link the second time you will receive this error.
I upgraded from 7.3.0 to 8.0.0 and am now having this issue as well. I enter my Shopify domain on my app's install screen, hit Authorize in the Shopify admin page, and am immediately hit with this:

Within the giant HTML dump I also see
Oauth error invalid_request: The authorization code was not found or was already used
After running bundle update shopify_app I reset the database, restarted the app, and uninstalled the app from my Shopify store. Still getting the same error each time.
I will continue to try to figure out some more info.
Figured it out! Running the generator duplicated the provider in the omniauth initializer. Removing that extra provider for shopify solved the issue.
You shouldn't need to run the generator to update the gem. We try our best to keep as much code as possible in the gem to avoid this.
Figured it out! Running the generator duplicated the provider in the omniauth initializer. Removing that extra provider for shopify solved the issue.
I was having a problem using it with devise, removing the omniauth.rb initializer solved my problem thank you!!
Most helpful comment
Figured it out! Running the generator duplicated the provider in the omniauth initializer. Removing that extra provider for shopify solved the issue.