Skip to main content

Authentication State API

The Authentication State API provides the buyer's current authentication level in customer accounts. Use this API to determine whether the buyer is fully signed in or viewing the page through a pre-authenticated link, such as from an order confirmation email.

The authentication state is read-only. To prompt the buyer to log in, use the Require Login API.

Pre-authenticated buyers may have limited access to protected customer data, which can cause some API properties to return undefined.

  • Conditional content rendering: Show different UI depending on whether the buyer is fully authenticated or viewing the page through a pre-authenticated link.
  • Prompt for sign-in: Detect when a buyer is pre-authenticated and display a message encouraging them to sign in for a richer experience.
  • Protect sensitive data: Only display detailed customer information when the buyer is fully authenticated.

The shopify global object provides the authentication state. Access the following property on shopify to determine how the buyer accessed the Order status page.

Anchor to authenticationState
authenticationState
<>
required

The buyer's current authentication level on the Order status page. Use this to determine whether to display sensitive information or prompt the buyer to log in.

Read-only. The authentication level can't be changed programmatically.


  • Combine with Require Login API: Use authenticationState to check the current state and requireLogin() to trigger a login prompt when full authentication is needed.
  • Degrade gracefully for pre-authenticated users: Design your extension to show useful but non-sensitive content for pre-authenticated users, and offer a sign-in prompt for more detailed information.

Was this page helpful?