> For the complete documentation index, see [llms.txt](https://docs.2checkout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/single-sign-on-sso/sso-by-subscription-reference.md).

# SSO by subscription reference

Use the **getSingleSignOn** method to redirect and login shoppers automatically from your user portal into their 2Checkout myAccount based on subscription information. This method connects third-party user hubs with the 2Checkout myAccount, and allows your shoppers to seamlessly sign in to manage their information and perform tasks such as updating/changing credit card details.

## Request parameters

| Parameter               | Type / Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sessionID`             | <p><strong>Required (string)</strong></p><p>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>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `subscriptionReference` | <p><strong>Required (string)</strong></p><p>Unique, system-generated subscription identifier.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `email`                 | <p><strong>Optional (string)</strong></p><p>End-user email address belonging to the customers associated with the subscription.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `validityTime`          | <p><strong>Optional (int)</strong></p><p>The time, in seconds, before the single sign-on URL expires. By default, the URL expires after 10 seconds.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `accessPage`            | <p><strong>Optional (string)</strong></p><p>The specific myAccount page you want the user to be redirected to. Possible values: view\_order, my\_license, change\_card, my\_products, payment\_methods, user\_data, order\_lookup, faq — default: index page.<br>Details:</p><ul><li>view\_order — based on the <code>SubscriptionReference</code>, redirects shoppers to the myAccount page for the initial order that served to purchase the subscription. The 2Checkout system will match the subscription to the order automatically, displaying its associated myAccount view\_order page.</li><li>my\_license — redirect shoppers to the subscription's page of myAccount based on the <code>SubscriptionReference</code> you provide.</li><li>change\_card — redirects shoppers to the subscription page of myAccount and opens up the change credit card pop-up window designed to update the payment details associated with a subscription.</li><li>my\_products — redirects shoppers to the myAccount page designed to list all products purchased from 2Checkout. <https://store.YourCustomDomain.com/m...t/my_products/></li><li>user\_data — redirects shoppers to the Personal Information page in myAccount<br><https://store.YourCustomDomain.com/m...unt/user_data/></li><li>order\_lookup — redirects shoppers to the Order Lookup page of myAccount.<br><https://store.YourCustomDomain.com/m.../order_lookup/></li><li>faq — redirects shoppers to the Support page of myAccount<br><https://store.YourCustomDomain.com/support/></li><li>default: index page — redirects shoppers to myAccount homepage<br><https://store.YourCustomDomain.com/myaccount/>?</li></ul> |
| `validationIp`          | <p><strong>Optional (string)</strong></p><p>The IP address of the shopper, necessary for security purposes. Can be an empty string or a valid IP, or null.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

### Request sample

```php
<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$email = 'EMAIL@EXAMPLE.COM';
$validityTime = 50;
$accessPage = 'my_license';
$validationIp = null;

$jsonRpcRequest = array (
  'method' => 'getSingleSignOn',
  'params' => array($sessionID, $subscriptionReference, $email, $validityTime, $accessPage, $validationIp),
  'id' => $i++,
  'jsonrpc' => '2.0'
);

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
```

## Response parameters

<table><thead><tr><th width="188.39990234375">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>Single sign-on URL</code></td><td><p><strong>String</strong></p><p>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.</p></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/single-sign-on-sso/sso-by-subscription-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
