App reviews, troubleshooting, and recommendations
I developed an app in the past. When the app is installed, Shopify delivers a token to our app which can be used to make calls to Shopify's API on behalf of the store. This token never expired (or the expiration was relatively far in the future).
I'm developing a new app now, and I'm noticing that access tokens are expiring in 24 hours. These tokens begin with 'shpat_'.
My app will need to make requests on behalf of the shop to Shopify's API daily. It's no good if access tokens expire for shops after 24 hours.
So what gives? Did Shopify make some change? Or is this happening because my app is in development mode? What's going on?
Solved! Go to the solution
This is an accepted solution.
Solved.
I am using the @shopify/koa-shopify-auth package, and turns out accessMode is by default set to "online", and per the docs, online access token lifetimes match the lifetimes of the user's web session.
The solution was to set accessMode to "offline" via the shopifyAuth middleware function.
This is an accepted solution.
Solved.
I am using the @shopify/koa-shopify-auth package, and turns out accessMode is by default set to "online", and per the docs, online access token lifetimes match the lifetimes of the user's web session.
The solution was to set accessMode to "offline" via the shopifyAuth middleware function.
Thanks, Chad_Johnson!
For those who might need the code, here how it looks like (with https://github.com/Shopify/koa-shopify-auth 😞
app.use(
shopifyAuth({
accessMode: 'offline',
async afterAuth(ctx) {
const { shop, accessToken } = ctx.state.shopify
// handle after auth....
},
}),
)
quality answer 🙂
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024