"Cannot complete OAuth process" error when user lets OAuth process time out using koa-shopify-auth

benfarhner
New Member
2 0 0

Our app is getting rejected for an Internal Server Error that is originating from the `koa-shopify-auth` library (latest version) that we're using for the OAuth process when a merchant installs our app. The only way we can reproduce the problem is if we wait 60 seconds after beginning installation before completing the OAuth process, which causes the token to expire. The `koa-shopify-auth` library as well as the main `@shopify/shopify-api` library both handle this scenario by directly responding with a 500 Internal Server Error, rather than letting the developer handle the scenario appropriately. See https://github.com/Shopify/shopify-node-api/issues/130 and https://github.com/Shopify/koa-shopify-auth/issues/88.

Ideally, we'd be able to detect the error (say, catch an exception) and handle it gracefully by redirecting the client to restart the auth process. Based on the 2 issues above, I know I'm not alone in this situation. How have others worked around this? Do I just need to fork `koa-shopify-auth` and handle it myself or is there an existing workaround I can implement that will let me redirect when the token expires?

I will say it's pretty frustrating that Shopify is rejecting our app for a behavior that is intentionally baked into their official library.

0 Likes
Kevin_A
Shopify Staff
Shopify Staff
315 42 54

Hey @benfarhner 

One of the issues you referenced looks like it was resolved in the most recent library version. Can you try updating and see if you still encounter this issue. 

Kevin_A | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes