Amazon Cognito authentication error immediately after being redirected from Shopify store to my app

Highlighted
Tourist
10 0 0

We use AWS Amplify and Cognito for authentication in our react app. Recently we wanted to develop a feature that enables merchants to link their Shopify store to our React app. For that, the merchant first enters their store URL, and then we direct him to the permission grant page, After he approves our app to be installed in their store, the user is redirected back to our app.

The problem occurs at this point. When we check the console, what we see is as follows.

invalid_grant.PNG

After the user is redirected, we send `code` param to the backend and get an access token. We tried removing those all code and redirecting to the same page from a Shopify store, but the error is still occurring. And to our surprise, this issue with redirecting only happens with Shopify. We have a similar procedure to link a Magento 1 site, but we don't see this kind of error when the user is redirected from the Magento site to our app.

Is there someone who knows what is happening here? All helpful suggestions are highly appreciated.

0 Likes