Hi
I am developing an app for embeded admin interface in Shopify. I am using Node JS and Remix. I follow all shopify’s best practices and am encountering an issue.
basically when I pick a plan, I get redirected to approval page, I approve and when I am being redirected back I go to login page, so it logs me out basically. I understand its a session issue but no matter what I do I keep being redirected to login page. Here is my code below for confirmation:
import { redirect } from “react-router”;
import { activateSubscription } from “../models/Subscription.server”;
export const loader = async ({ request }) => {
const url = new URL(request.url);
const shop = url.searchParams.get(“shop”);
const chargeId = url.searchParams.get(“charge_id”);
if (!shop) {
throw new Response("Missing shop param", { status: 400 });
}
if (chargeId) {
await activateSubscription(shop, chargeId);
}
return redirect(`/app/plans`);
};
For context, I use ngrok to expose my local host since am still developing.
Any advice on how to solve this issue would be appreciated!