App reviews, troubleshooting, and recommendations
I have an app and I am getting the webhook notification when a cart is updated. Now I want to call an rest admin api to update a product information but I'm unable to get the access token of the store. I know we can save the access token in database but for initial testing I want it in a variable to call rest put api.
Solved! Go to the solution
This is an accepted solution.
To get the access token we can use res.locals.shopify.session and it is also creating a table in sqlite database you can see the database using DB Broswer SQLight.
To use it on server side to make an api call to shopify you can access it from the database file.
Hello @haseebintegriti,
I am Gina from flareAI app helping Shopify merchants get $6Million+ in sales from Google Search, on autopilot.
The access token is generated when you are adding the app. If you have not saved it to the database, probably you have missed the token and you can't retain it.
I would advise saving the access token while the app is added to a store. In your case, you can simply remove and add the app again and this time remember to save the generated access token to your database and use it as a variable while making the API calls.
Shopify apps often need to make API calls on behalf of the store even when the user is not actively interacting with the app. Storing the access token in a database allows the app to persistently authenticate and make authorized requests to the Shopify API.
Hope this helps
Gina
Thank you @flareAI for helping me out.
I want to know how I can save the access token in nodejs shopify app boilerplate. Where to add the code to store the access token. Can you share some example code of it in the updated boilerplate template?
Thank you.
Hello @haseebintegriti,
Gina here from flareAI app
Sorry. I don't know how to get access token in Node js. However, you can take a look at these references.
Build a Shopify app
Get an access token
Hope this helps
Gina
This is an accepted solution.
To get the access token we can use res.locals.shopify.session and it is also creating a table in sqlite database you can see the database using DB Broswer SQLight.
To use it on server side to make an api call to shopify you can access it from the database file.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024