# SSO by customer reference

Use the **getSingleSignOnByCustomer** method to create Single Sign On links into 2Checkout myAccount based on customer references (IDs). Use either the 2Checkout Customer Reference or the External Customer Reference to identify specific customers.

## Request parameters

<table><thead><tr><th width="139.3333740234375">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><strong>Required (string)</strong><br>Session identifier, the output of the <strong>Login</strong> method. Include <code>sessionID</code> into all your requests. 2Checkout throws an exception if the values are incorrect. The <code>sessionID</code> expires in <strong>10 minutes</strong>.</td></tr><tr><td><code>idCustomer</code></td><td><strong>Required (string)</strong><br>Unique customer identifiers. Can be either the <code>ExternalCustomerReference</code> you control or the system-generated <code>2CheckoutCustomerReference</code>.</td></tr><tr><td><code>customerType</code></td><td><p><strong>Required (string)</strong><br>Possible values:</p><ul><li><code>ExternalCustomerReference</code></li><li><code>2CheckoutCustomerReference</code></li></ul></td></tr><tr><td><code>page</code></td><td><p><strong>Optional (string)</strong><br>The specific myAccount page where you redirect the customer.<br>Possible values:</p><ul><li><strong>my_subscription</strong> - redirect shoppers to the subscription's page of myAccount based on the <code>SubscriptionReference</code> you provide.</li><li><strong>my_products</strong> - redirects shoppers to the myAccount page designed to list all products purchased from 2Checkout.<br>https://store.YourCustomDomain.com/myaccount/my_products/</li><li><strong>user_data</strong> - redirects shoppers to the Personal Information page in myAccount<br>https://store.YourCustomDomain.com/myaccount/user_data/</li><li><strong>order_lookup</strong> - redirects shoppers to the <strong>Order Lookup</strong> area of myAccount:<br>https://store.YourCustomDomain.com/myaccount/order_lookup/</li><li><strong>faq</strong> - redirects shoppers to the Support page of myAccount<br>https://secure.YourCustomDomain.com/support/</li><li><strong>payment_methods</strong> – redirect shoppers to the Payment Methods area of myAccount:<br>https://store.YourCustomDomain.com/myaccount/payment_methods/<br>Do not include PAGE in the URL to redirect shoppers to myAccount homepage:<br>https://store.YourCustomDomain.com/myaccount/</li></ul></td></tr><tr><td><code>request</code></td><td><strong>Optional (string)</strong><br>Needed for 'my_subscription'<br>Request[] = code=123D40F123 redirects customers to the page for the subscription with the 123D40F123 <code>SubscriptionReference</code> value.</td></tr><tr><td><code>validityTime</code></td><td><strong>Optional (int)</strong><br>The time, in seconds, before the single sign-on URL expires. By default, the URL expires after 10 seconds. (optional)</td></tr><tr><td><code>validationIp</code></td><td><strong>Optional (string)</strong><br>The IP address of the shopper, necessary for security purposes. Can be an empty string or a valid IP, or null.</td></tr></tbody></table>

### Request sample

```php
<?php

require ('PATH_TO_AUTH');

$idCustomer = '352365983';
$customerType = '2CheckoutCustomerReference';
$page = 'my_license';
$request = null;
$validityTime = 50;
$validationIp = null;
$languageCode = 'en';

try {
    $ssoLINK = $client->getSingleSignOnByCustomer(
        $sessionID,
        $idCustomer,
        $customerType,
        $page,
        $request,
        $validityTime,
        $validationIp,
        $languageCode // optional
    );
}
catch (SoapFault $e) {
    echo "ssoLINK: " . $e->getMessage();
    exit;
}
var_dump("ssoLINK", $ssoLINK);
```

## Response parameters

<table><thead><tr><th width="192.666748046875">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>Single sign-on URL</code></td><td><strong>String</strong><br>The string generated is the complete single sign-on URL pointing to 2Checkout myAccount, containing the unique URL. Shoppers using it log into their 2Checkout myAccount automatically.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/single-sign-on-sso/sso-by-customer-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
