OAuth flow is redirecting to the store's admin Home, not redirecting to callback URI

Cryptacular
Shopify Partner
1 0 0

We're having a bit of an odd issue. We have a non-embedded app that's integrating with Shopify through the OAuth flow. This used to work but ever since uninstalling the app from our development store, we are unable to uninstall it again (may be related, but may not be).

 

What happens is:

 

  1. User starts OAuth flow from our website
  2. User is redirect to Shopify login screen
  3. When user logs in, they are redirected to the shop's admin portal, specifically the "Home" screen
    1. This is where we were previously asked to confirm installing the app with it's requested scopes, but this is no longer happening
    2. It also means it is never redirecting back to our callback URI, so we cannot store the session

 

We're super confused as to why this is happening. I can't find any logs or errors anywhere. It's especially weird because this used to work, and even going back to a previous version of our website, it still shows the same behaviour.

 

We are using Next.js, as well as the `@Shopify/shopify-api` NPM package. This is our code for starting the OAuth flow:

 

 

import "@shopify/shopify-api/adapters/cf-worker";
import { shopifyApi } from "@shopify/shopify-api";
import { NextResponse } from "next/server";
import { SHOPIFY_APIVERSION } from "@/utils/supabase/constants";

const shopify = shopifyApi({
  apiKey: process.env.SHOPIFY_CLIENT_ID,
  apiSecretKey: process.env.SHOPIFY_CLIENT_SECRET!,
  scopes: ["read_products"],
  hostName: process.env.SEAMLESSLY_HOSTNAME!,
  hostScheme: "https",
  apiVersion: SHOPIFY_APIVERSION,
  isEmbeddedApp: false,
});

export default shopify;

export function beginShopifyAuth(
  shop: string,
  req: Request,
  isOnline: boolean
) {
  return shopify.auth.begin({
    shop,
    callbackPath: "/api/shopify/auth/callback",
    isOnline,
    rawRequest: req,
    rawResponse: new NextResponse(),
  });
}

 

 

Thanks in advance, looking forward to anyone's ideas.

Replies 0 (0)