Will access token expired?

Solved
alcfy
Shopify Partner
6 0 1

I have request an access token and saved it in my database so all my apps can use it. It works on that day but on the next day my app start getting 401 error saying my token is not valid. It works again after I make a OAuth request and update the token on my database.

 

In the documentation it seems access token is permanent, but none of it explicitly state that. Is access token permanent or will it expired? If it expired, what is the duration of the token?

Accepted Solution (1)

Accepted Solutions
Busfox
Shopify Staff (Retired)
Shopify Staff (Retired)
628 49 109

This is an accepted solution.

Hi @alcfy,

 

Offline access tokens don't expire unless your app is uninstalled or you revoke the access token. Online access tokens on the other hand, only last as long as the user's admin session. You can read about the different access modes here.

 

Can you check which mode you are using?

Andrew | 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 the Shopify Help Center or the Shopify Blog

View solution in original post

Replies 5 (5)
Busfox
Shopify Staff (Retired)
Shopify Staff (Retired)
628 49 109

This is an accepted solution.

Hi @alcfy,

 

Offline access tokens don't expire unless your app is uninstalled or you revoke the access token. Online access tokens on the other hand, only last as long as the user's admin session. You can read about the different access modes here.

 

Can you check which mode you are using?

Andrew | 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 the Shopify Help Center or the Shopify Blog

alcfy
Shopify Partner
6 0 1

It does seems my token is online access token, thanks for the info. Would appreciate if it is mentioned in the OAuth doc

souravchandra
Tourist
19 0 1

Hi,

 

How can I revoke access token?

 

Thanks,

Sourav

dgtlmonk
Shopify Partner
24 2 4

How do we request for offline access token?

 

nm, found a relevant thread

hugo4711
Shopify Partner
17 1 1

If anyone stumbles upon this:

If you are using KOA, then 'online' mode is DEFAULT! This is completely misleading...

 

https://www.npmjs.com/package/@shopify/koa-shopify-auth

 

ATTENTION: verifyRequest and shopifyAuth BOTH need to specify 'offline' as default. See the documentation!

 

https://community.shopify.com/c/shopify-apis-and-sdks/get-offline-access-token-from-koa/m-p/608000#M...