Skip to main content

Add Sign in with Shop to your external login page

Sign in with Shop provides a secure and streamlined way for users with existing Shop accounts to authenticate on your platform. This tutorial shows you how to integrate Sign in with Shop using OpenID Connect (OIDC), whether you host your own login page or use a third-party identity platform. By incorporating Sign in with Shop into your login process, you'll provide users with a frictionless, trusted authentication experience.


In this tutorial, you'll learn how to:

  • Configure the Sign in with Shop API client in Shopify admin.
  • Create and add the official Sign in with Shop button to your login page.
  • Locate the necessary OpenID Connect (OIDC) endpoints.
  • Integrate Sign in with Shop with common third-party identity platforms using OIDC.
  • Integrate Sign in with Shop on a self-hosted login page.


Anchor to Step 1: Set up your API clientStep 1: Set up your API client

Activate the Sign in with Shop API client in your Shopify admin to get the necessary credentials:

  1. In your Shopify admin, go to the Shop sales channel settings page and activate your Sign in with Shop API client.
  2. Copy and securely store your Client ID and Client Secret. If you lose access to your secret or if it's been compromised, you can revoke it and generate a new one in your Shopify admin.
  3. Configure the following Redirect URLs based on your integration type:
    • Third-party identity platform: Enter the callback URL provided by your identity provider (such as Auth0, Ping Identity, or AWS Cognito). Refer to your provider's documentation for the callback URL format.
    • Self-hosted login page: Enter your own callback URL (e.g., https://your-domain.com/auth/callback).

Anchor to Step 2: Get the official Shop buttonStep 2: Get the official Shop button

Note

If you're using Auth0 as your identity provider, then you can skip this step as the Sign in with Shop button is available on the Auth0 marketplace.

Use our official Sign in with Shop button on your login page. Using the Shopify button ensures brand consistency and helps users recognize a trusted sign-in method. Choose one of the following options:

Anchor to Option 1: Customize your Shop buttonOption 1: Customize your Shop button

Use our interactive button builder to create and customize your Sign in with Shop button:

AttributeTypeDescription
variantStringThe updated version of the button with the revised text.

Accepted values: continue, sign-in, sign-up or logo.
disabledBooleanAn optional parameter. If true, then the button does nothing when clicked.
Defaults to false.
borderedBooleanAn optional parameter. If true, then the button includes a light border.
Defaults to false.
full-widthBooleanWhether the button will expand to fill its container width.

NameDescriptionConstraints
--button-padding-inlineThe horizontal padding of the button.Default: 32px

Minimum: 16px
--button-padding-blockThe vertical padding of the button.Default: 14px

Minimum: 8px
--buttons-radiusThe border radius of the button.Default: 12px
--font-paragraph--sizeThe size of the button's font.Default: 14px

Minimum: 12px
--font-paragraph--line-heightThe height of the button's text line.Default: 16px

Minimum: 14px

Anchor to Option 2: Use pre-approved buttonsOption 2: Use pre-approved buttons

As an alternative to using a custom image button, you can download our pre-approved Sign in with Shop buttons provided in PNG and SVG formats.


Anchor to Step 3: Integrate your login pageStep 3: Integrate your login page

Choose the integration method matching how your login page is hosted. Before you begin, ensure you have the following ready:

  • Client ID and Client Secret
  • Sign in with Shop button (if you are not integrating with Auth0)

Anchor to Option 1: Integrate with a third-party identity platformOption 1: Integrate with a third-party identity platform

You can use a third-party identity platform (such as Auth0, Ping Identity, or AWS Cognito), or use your own self-hosted login page.

Go to the Sign in with Shop listing on the Auth0 marketplace, click Add Integration, and follow the installation guide.

  1. Follow your identity provider's instructions to add a social login or custom OIDC connection.
  2. Use the Client ID and Client Secret you saved from Step 1.
  3. Use the following values to configure your OIDC connection:
EndpointURL
Issuerhttps://accounts.shop.app
Discoveryhttps://accounts.shop.app/.well-known/openid-configuration
Authorizationhttps://accounts.shop.app/oauth/authorize
Tokenhttps://accounts.shop.app/oauth/token
UserInfohttps://accounts.shop.app/oauth/userinfo
JWKShttps://accounts.shop.app/auth/jwks
  1. Set the required scopes to openid email. Optionally, you can add the profile scope to retrieve the user's name and picture.
  2. Add the official Sign in with Shop button in your identity platform's login page or template.
  3. Enable Proof Key for Code Exchange (PKCE) with code challenge method S256.
  4. Finalize your platform-specific configuration:
PlatformInstructions
Ping IdentityWhen creating the custom OIDC connection, map the email attribute:Email Address → providerAttributes.emailAdd the following application attribute mappings:• sub → User ID• email → Email Address• email_verified → $(user.emailVerified == true || true)
AWS CognitoWhen adding the OIDC identity provider, select Email as the required sign-in identifier and attribute.
Other providersFollow your provider's documentation for creating a custom OIDC integration. Confirm you've properly configured all endpoints and scopes.

Anchor to Option 2: Integrate with a self-hosted login pageOption 2: Integrate with a self-hosted login page

If you maintain your own login page, you'll need to implement the OIDC authentication flow:

  1. Choose one of the following options to add the Sign in with Shop button:

    • Use the button builder or pre-approved buttons from Step 2 with your own click handler.

    • Use our JavaScript SDK component that handles the button and click behavior:

      <script type="module" src="https://cdn.shopify.com/shopifycloud/shop-js/modules/v2/loader.shop-login-button.esm.js"></script>
      <style>
      shop-login-button {
      --button-padding-inline: 12px;
      --button-padding-block: 2px;
      --buttons-radius: 8px;
      --font-paragraph--size: 18px;
      --font-paragraph--line-height: 20px;
      }
      </style>
      <shop-login-button
      ux-mode="redirect"
      client-id="YOUR_CLIENT_ID" // Replace with your Client ID from Step 1
      code-challenge-method="S256"
      code-challenge="GENERATED_CODE_CHALLENGE" // Replace with generated PKCE code challenge
      response-type="code"
      scope="openid email profile" // Include profile scope if needed
      redirect-uri="YOUR_REDIRECT_URI" // Replace with your callback URL from Step 1
      state="GENERATED_STATE" // Replace with a random state value
      analytics-context="loginWithShopSelfServe"
      />

      The <shop-login-button> component accepts the following attributes. All attributes are required unless specified as optional:

      AttributeValueDescription
      client-idYour Sign in with Shop API client IDObtained from Shopify admin
      ux-moderedirectHandles auth through page redirects
      code-challenge-methodS256PKCE security method
      code-challengeRandom string hashed with SHA256Prevents auth code interception
      response-typecodeAuth code flow type
      scopeRequired: openid email. Optional: profileRequested access permissions
      redirect-uriYour callback URLWhere to send auth response
      stateRandom stringSecurity parameter to prevent CSRF attacks
      analytics-contextloginWithShopSelfServe
      borderedOptional Boolean attributeWhen present, the button includes a light border
      full-widthOptional Boolean attributeWhen present, the button expands to fill its container width
  2. Implement the OIDC authorization flow:


Sign in with Shop supports multiple languages so users can login in their preferred language. This feature enhances user accessibility and helps you accommodate a diverse user base.

Depending on the context, the Sign in with Shop button can display in different variants (variant) depending on the context:

  • Sign in with Shop

  • Continue with Shop

  • Sign up with Shop.

    Regardless of the variant you choose, the text for each button text is translated according to the defined locale.

    For example, the following are the variants' translations in French:

  • Sign in with Shop: Se connecter avec Shop

  • Continue with Shop: Continuer avec Shop

  • Sign up with Shop: S'inscrire avec Shop

    The ShopJS library supports and defines the following locales, which contains translations for the button text:

Locale CodeLanguage
csCzech
daDanish
deGerman
elGreek
enEnglish
esSpanish
fiFinnish
frFrench
hiHindi
hr-HRCroatian
huHungarian
idIndonesian
itItalian
jaJapanese
koKorean
lt-LTLithuanian
msMalay
nbNorwegian Bokmål
nlDutch
plPolish
pt-BRPortuguese - Brazil
pt-PTPortuguese - Portugal
ro-RORomanian
ruRussian
sk-SKSlovak
sl-SISlovenian
svSwedish
thThai
trTurkish
viVietnamese
zh-CNChinese - Simplified
zh-TWChinese - Traditional
Tip

Regularly review the supported locales and translations to ensure they meet the needs of your user base.

Anchor to Language Selection PriorityLanguage Selection Priority

The button's language selection is based on the following priority rules:

  1. HTML Document Language: The system first checks whether the document specifies the language it's been written in. To do so, it reads the lang attribute set on the <html> element of your document. If this attribute is present and the specified language is supported, the button will display the corresponding translation.

    The following is an example of how to set the language in the HTML code:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    ...
    </head>
    <body>
    ...
    </body>
    </html>
    Tip

    Include the lang attribute in your HTML <html> tag as a best practise to provide a consistent user experience to your international users.

  2. Browser setting: If the document doesn't specify the language, then the system checks the user's preferred languages set in their browser. If translations are available for one of those languages, then the button displays in one of the user's selected language, following the order of priority set in the browser.

  3. Default language: If neither the HTML document language nor the browser setting is supported, then the button defaults to English.


Was this page helpful?