Help with Shopify App Routing: Auth Callback , Root Endpoint

Topic summary

  • Goal: For a standalone Shopify app (Node.js template), trigger /api/auth/callback during the first installation (OAuth callback), and thereafter open the app’s root endpoint (app.get(“/”)) when launched from the Shopify admin.

  • Problem: When the root endpoint is defined, it is hit immediately after installation and the /api/auth/callback route is skipped entirely during install. The desired behavior is callback on first install, then root on subsequent launches.

  • Attempt/Idea: Another developer reported the same issue and used conditional routing (e.g., checking install/session state to decide between redirecting to auth or serving the root). They are seeking a cleaner or more robust strategy.

  • Latest update & status: The original poster requested details on how the conditional routing was implemented. No concrete solution or best practice has been provided yet; discussion remains open.

Summarized with AI on December 13. AI used: gpt-5.

Hi everyone,

I’m working on a standalone Shopify app using the Node.js template, and I’ve run into a routing issue.

What I Want to Achieve:1. During the first installation of the app:

  • The Shopify app should hit the api/auth/callback endpoint to handle authentication.
  1. After the app is installed:
    • When the user clicks the app from their Shopify admin, it should hit the root endpoint (app.get(“/”)) instead of going through api/auth/callback again.

Current Problem:- If I define the root endpoint (app.get(“/”)), it gets called after installation, and the api/auth/callback endpoint is skipped entirely during installation.

  • I need api/auth/callback to be called during the first installation and app.get(“/”) to be accessed after the installation when the app is launched.

I enchanted the same issue. i use a conditional routing to do it . But hopes someone could provide a better stategy.

Hi,
could you please clarify what you did, for example, did you provide a if condition.