Shopify / koa-shopify-auth

DEPRECATED Middleware to authenticate a Koa application with Shopify
MIT License
80 stars 64 forks source link

What will happen if access token expired in between call (GraphQL/Rest) #100

Closed knsakib closed 3 years ago

knsakib commented 3 years ago

Overview/summary

I would like to know what will happen, if the token expired in between the Shopify API call.

Let's say, the user started the app(by clicking the app button in the Shopify app section) with a valid access token. And while he was using the app(clicking different sections in the app) the online token expired in the middle of app use. What will happen then. Will the user be redirected to auth again or not. I did not see that code. I can see redirects in the beginning. For example when a user clicks the app icon with an expired token at that time he will reinitialize the auth and that is fine. But I am concern about expiration in between use. Maybe I am missing some fundamental understanding of how session works and access token expiration.

...

What inspired this enhancement? Because I can see for 401, I can see it is doing nothing, Other than check the lines, koa-shopify-auth/src/verify-request/verify-token.ts from line 25-45. if (e instanceof HttpResponseError && e.code == 401){ // only catch 401 errors } else { throw e ...

paulomarg commented 3 years ago

Hi @knsakib, thank you for your question. If your action is using verifyRequest, this scenario would end up in one of two cases:

You can see our example app (server.js and the corresponding call in _app.js) for a practical example.

We encourage partners to ask questions in our Community Forums, but we use GitHub issues to track actual bugs or issues with our code. I'm closing this issue since it's not a code issue, but please let us know if you encounter any problems going forward!