Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

Require Login API

The Require Login API triggers a sign-in prompt for buyers viewing a pre-authenticated order status page. Use it to require the buyer to sign in before performing sensitive actions.

  • Gate sensitive information: Prompt the buyer to sign in before showing detailed order data, account-specific actions, or personalized content.
  • Enforce authentication for actions: Require sign-in before allowing the buyer to perform actions like initiating a return or updating their address.

The Require Login API object provides the requireLogin method. Access it on the API object to trigger a login prompt.

Anchor to requireLogin
requireLogin
() => Promise<void>
required

Triggers a login prompt if the buyer is viewing a pre-authenticated Order status page. Returns a promise that resolves when the login prompt is dismissed or completed.


  • Check authentication state first: Use the Authentication State API to check whether the buyer is already authenticated before calling requireLogin.
  • Don't block the initial render: Call requireLogin in response to a buyer action, not during the initial render. This avoids unexpected login prompts when the page loads.

  • requireLogin() only triggers a login prompt — it doesn't guarantee the buyer will complete the login. Your extension should gracefully handle the case where the buyer dismisses the prompt.
  • This API is only available on the Order status page. It isn't available on other customer account extension targets.

Was this page helpful?