App reviews, troubleshooting, and recommendations
Currently I'm building out an express app using the Shopify tutorial for node.js and express.js, but I run into an error that states: Error: Cannot complete OAuth process. No session found for the specified shop url: store_url.com . The error occurs at: await Shopify.Auth.validateAuthCallback().
var router = require("express").Router();
module.exports = router;
var Shopify = require("@shopify/shopify-api").Shopify;
var ApiVersion = require("@shopify/shopify-api").ApiVersion;
Shopify.Context.initialize({
API_KEY: process.env.SHOPIFY_API_KEY,
API_SECRET_KEY: process.env.SHOPIFY_API_SECRET,
SCOPES: process.env.SHOPIFY_API_SCOPES,
HOST_NAME: global.env.ROOT_URL.replace(/https:\/\//, "") + "/api/shopify",
API_VERSION: ApiVersion.Unstable,
IS_EMBEDDED_APP: false,
});
var shops = [];
router.get("/", async function (req, res, next) {
if(typeof shops[req.query.shop] !== 'undefined') {
console.log("Already Logged Signed Up");
}else{
res.redirect("/api/shopify/auth?shop="+req.query.shop);
}
});
router.get("/auth", async function (req, res, next) {
const authRoute = await Shopify.Auth.beginAuth(req, res, req.query.shop, '/auth/callback', false);
res.redirect(authRoute);
});
router.get("/auth/callback", async function (req, res, next) {
const shopSession = await Shopify.Auth.validateAuthCallback(req, res, req.query);
shops[req.query.shop] = shopSession;
res.redirect("");
});
Solved! Go to the solution
This is an accepted solution.
I did find the solution. I changed versions of the API from unstable to most recent stable and updated my library. That seems to have fixed it.
Thank You
Can you share your session SESSION_STORAGE (especially the load and store functions)? It is most likely the source of error.
This error is raised because in the app is not able to load the session stored see this code where this error is raised here.
Some nit remarks about your code
This is an accepted solution.
I did find the solution. I changed versions of the API from unstable to most recent stable and updated my library. That seems to have fixed it.
Thank You
Hi Mikhail, what api did you change and to what version?
Could you show the code example please?
Thank you!
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024