how to get offline access token

Highlighted
Excursionist
28 2 1

I'm trying to create an app that uses the offline access token (not the refresh or online one) i need it to do other stuff in my app. How can i extract it and save it in a variable or in cookies using nodejs and koa?

Highlighted
Shopify Partner
129 27 31

The access token you get when a user installs your app is already the offline one according to the docs: https://help.shopify.com/en/api/getting-started/authentication/oauth/api-access-modes

 

What kind of stuff do you need to do and which errors are you getting?

- Yes, we build Shopify Apps. Hit me with your idea: https://vellir.tech
- Let customers preview your products and easily add them to cart with Peek Mode
- Add free, good looking social share icons with built-in analytics to your store with Share Lab
- Manage your new arrivals with Newr
0 Likes
Highlighted
Shopify Partner
129 27 31

So I did some digging and found that even though the docs I mentioned above say `offline` is the default mode, that's not what happens in the koa-shopify-auth library.

 

If you followed the node/react tutorial, try to change this bit in your server.js file:

 

 
createShopifyAuth({
      apiKey: SHOPIFY_API_KEY,
      secret: SHOPIFY_API_SECRET,
      scopes: [YOUR SCOPES HERE],
accessMode: 'offline', // <<<< ADD THIS async afterAuth(ctx) { ... } })

 

Let me know how that goes.

 
- Yes, we build Shopify Apps. Hit me with your idea: https://vellir.tech
- Let customers preview your products and easily add them to cart with Peek Mode
- Add free, good looking social share icons with built-in analytics to your store with Share Lab
- Manage your new arrivals with Newr
0 Likes
Highlighted
Excursionist
28 2 1

No, it changes.

0 Likes