Skip to content

shopify app remix: how to hook into "install" event #2081

Open
@redochka

Description

app created using shopify cli 3.74

I have shopify.server.ts where we define the authPathPrefix:

const shopify = shopifyApp({
  apiKey      : process.env.SHOPIFY_API_KEY,
  apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
  apiVersion  : apiVersion,
  scopes      : process.env.SCOPES?.split(","),
  appUrl      : process.env.SHOPIFY_APP_URL || "",
  //It does not seem to be used...
  authPathPrefix: "/auth",
  sessionStorage: new RedisSessionStorage(process.env.UPSTASH_REDIS_URL),
  distribution  : AppDistribution.AppStore,
  future        : {
    unstable_newEmbeddedAuthStrategy: true,
    removeRest                      : true,
  },
  ...(process.env.SHOP_CUSTOM_DOMAIN
    ? {customShopDomains: [process.env.SHOP_CUSTOM_DOMAIN]}
    :{}),
});

And i have this app/routes/auth.$.tsx

import type {LoaderFunctionArgs} from "@remix-run/node";
import {authenticate} from "../shopify.server";

//it does not seem to be called at all
export const loader = async ({request}: LoaderFunctionArgs) => {
  console.log("inside auth.$.tsx");
  await authenticate.admin(request);
  return null;
};

I expected console.log("inside auth.$.tsx"); to be displayed at install time, but nothing.

Where is shopify auth being done? Sorry .. too much hidden magic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions