What do I do if the online access token gets expired while a user is interacting with the app?

jezsung
New Member
2 0 0

https://shopify.dev/concepts/about-apis/authentication#online-access

The above documentation says the online access token is meant to be used when a user is interacting with the app. But what if the token is expired during the use of the app? Suppose the app redirects the user to OAuth flow and gets the token and redirects the user to the origin again, but isn't it a bad user experience?

Replies 3 (3)
Cartbear
Tourist
9 0 2

Hi,

the documentation also says:

[...] where the access token's lifespan matches the lifespan of the user's web session.

So I would expect that the access token will not expire as long as the user is interacting with your app and the Shopify session is active.

If you have an embedded app another way is using the session token. In that case, you only use the OAuth authentication after the first install or permission scope changes.

https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens

 

MRG @ Cartbear
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
jezsung
New Member
2 0 0

How does Shopify know the lifetime of the user's web session? Isn't the expiration date pre-determined when the app obtains the online access token after the OAuth flow?

flu
New Member
3 0 0

Not only that, redirecting to the authorization page also does not work, has anyone encountered this problem?