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.
Anchor to Use casesUse cases
- 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.
Supported targets
- customer-account.
order-status. announcement. render - customer-account.
order-status. block. render - customer-account.
order-status. cart-line-item. render-after - customer-account.
order-status. cart-line-list. render-after - customer-account.
order-status. customer-information. render-after - customer-account.
order-status. fulfillment-details. render-after - customer-account.
order-status. payment-details. render-after - customer-account.
order-status. return-details. render-after - customer-account.
order-status. unfulfilled-items. render-after - customer-account.
order. page. render
Supported targets
- customer-account.
order-status. announcement. render - customer-account.
order-status. block. render - customer-account.
order-status. cart-line-item. render-after - customer-account.
order-status. cart-line-list. render-after - customer-account.
order-status. customer-information. render-after - customer-account.
order-status. fulfillment-details. render-after - customer-account.
order-status. payment-details. render-after - customer-account.
order-status. return-details. render-after - customer-account.
order-status. unfulfilled-items. render-after - customer-account.
order. page. render
Anchor to PropertiesProperties
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 authenticationStateauthenticationStateauthenticationStateSubscribableSignalLike<AuthenticationState>SubscribableSignalLike<AuthenticationState>requiredrequired
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.
SubscribableSignalLike
Represents a reactive signal interface that provides both immediate value access and subscription-based updates. Enables real-time synchronization with changing data through the observer pattern. This interface extends `ReadonlySignalLike` with deprecated fields that are still supported for backwards compatibility.
- current
The current value of the signal. Equivalent to `.value`, accessing this property subscribes to changes when used in a reactive context.
T - destroy
Cleans up the subscription and releases any resources held by this signal. After calling `destroy()`, the signal stops receiving updates from the main thread.
() => Promise<void> - subscribe
Subscribes to value changes and calls the provided function whenever the value updates. Returns an unsubscribe function to clean up the subscription. Use to automatically react to changes in the signal's value.
(fn: (value: T) => void) => () => void - value
The current value of the signal. This property provides immediate access to the current value without requiring subscription setup. Use for one-time value checks or initial setup.
T
AuthenticationState
The buyer's authentication status on the **Order status** page: - `'fully_authenticated'`: The buyer has logged in to their customer account. - `'pre_authenticated'`: The buyer accessed the page via a direct link, such as from an order confirmation email, without logging in.
'fully_authenticated' | 'pre_authenticated'Anchor to Best practicesBest practices
- Combine with Require Login API: Use
authenticationStateto check the current state andrequireLogin()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.