Skip to content

Shopify Dude Fix

Shopify Customer SSO Linked to the Wrong Account? Unlink the Identity Provider Subject With GraphQL

Shopify 2027-01 adds identityProviderSubjectDelete so Plus stores can programmatically unlink a customer’s third-party identity subject when SSO is mapped to the wrong customer profile.

Quick answer: Starting with Admin API version 2027-01, Shopify Plus integrations can use identityProviderSubjectDelete to unlink a customer’s third-party identity-provider subject from the customer record. Use it for verified identity-repair workflows, not as a generic logout button. Unlinking signs the customer out of existing sessions, and the subject can be linked again the next time the customer successfully signs in through the provider.
On this page

The problem this mutation solves

Shopify customer accounts can use a merchant’s own OpenID Connect identity provider on Shopify Plus. Shopify uses the customer’s email address and the provider’s sub claim to identify and link the customer.

If the wrong provider subject becomes associated with a Shopify customer, the shopper can run into a sign-in error such as “The sign-in method you used doesn’t match this account.” Until now, repairing that association was primarily an admin operation. Shopify’s 2027-01 Admin API adds a supported mutation so an app can perform the unlink as part of a controlled support or identity-management workflow.

Read the current subjects before deleting one

Do not guess at the subject ID from an email address or an external system. Query the customer and inspect identityProviderSubjects. Each subject object includes an ID, provider name, subject value, and timestamps.

A repair workflow should first show an operator enough information to distinguish the provider association being removed without exposing more customer data than necessary.

The mutation itself takes two IDs:

mutation UnlinkCustomerIdentity(
  $customerId: ID!,
  $subjectId: ID!
) {
  identityProviderSubjectDelete(
    customerId: $customerId,
    id: $subjectId
  ) {
    deletedIdentityProviderSubjectId
    customer {
      id
    }
    userErrors {
      field
      message
    }
  }
}

Example variables:

{
  "customerId": "gid://shopify/Customer/1234567890",
  "subjectId": "gid://shopify/IdentityProviderSubject/9876543210"
}

The mutation requires the write_customers access scope.

Unlinking is not deleting the customer

The Shopify customer profile, orders, and other store data remain. What changes is the association between that Shopify customer and the third-party identity subject.

Shopify states that unlinking signs the customer out of all existing sessions. When the customer signs in successfully through the identity provider again, Shopify can establish the link again based on the current identity information.

Build identity verification into the repair flow

This operation changes how a person authenticates, so it deserves more care than a normal profile edit. Shopify’s merchant documentation explicitly cautions administrators to verify a customer’s request using their identity-verification process before unlinking.

If you automate this through an internal support app, require an authenticated staff member and record a minimal audit trail: Shopify customer ID, provider name, subject ID removed, operator, timestamp, and support case reference. Avoid logging ID tokens, access tokens, cookies, or unnecessary customer profile data.

Do not use unlinking as a logout mechanism

If the business requirement is simply “sign this customer out,” unlinking the provider association is too destructive. The mutation changes the identity relationship, not just the active browser session.

Use it when the mapping itself is wrong, stale, or intentionally being reset. The resulting sign-out is a consequence of unlinking, not the primary purpose of the operation.

API-version planning matters

The delete mutation is introduced in 2027-01. The identity-provider subject object itself is already queryable in the current Admin API, but the programmatic unlink requires the newer version.

If your app is pinned to 2026-10, do not silently switch every request to a release-candidate API just for this feature. Isolate and test the version upgrade, or wait until your normal API-version migration reaches 2027-01.

Common misunderstanding: “Unlinking the subject removes the customer’s Shopify account.” It does not. Shopify removes the connection to the third-party identity provider. The customer record and commerce history remain. The next valid sign-in through that provider can create a fresh association.

How to test this

  1. Use a Shopify Plus test environment with customer accounts and a third-party identity provider configured.
  2. Sign in with a dedicated test customer and confirm the expected identity provider subject appears on the customer.
  3. Query Customer.identityProviderSubjects and record the specific subject ID used for the test.
  4. Run identityProviderSubjectDelete against API version 2027-01.
  5. Confirm the mutation returns the deleted subject ID and no userErrors.
  6. Verify the existing customer session is signed out.
  7. Confirm the Shopify customer profile and order history still exist.
  8. Sign in through the identity provider again and confirm the account links correctly.
  9. Test your support workflow with the wrong customer ID or wrong subject ID and ensure the error is surfaced rather than hidden.