---
schema_version: "1"
id: 318b56e8995915df70831d59a36bc06d4045bd041e03e8299bfdcc7551cd8459
title: ThirdPartyAccountLink
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_thirdpartyaccountlink.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_thirdpartyaccountlink.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 728c15a1445925645a787529e8f1dc32a91d7c9c0dafe29978cac5b25dbfd72b
description: Represents the list of external users who authenticated using an authentication provider. This object is available in API version 32.0 and later.
---
# ThirdPartyAccountLink

Represents the list of external users who authenticated using an authentication provider. This object is available in API version 32.0 and later.

A list of third-party account links is generated when users of an organization authenticate using an external authentication provider. Use this object to list and revoke a given user's social sign-on connections (such as Facebook©).

## Supported Calls

describeSObjects(), query()

## Special Access Rules

If you try to use [Apex DML operations](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_dml_section.htm) and then query this object in the same call, you get an UncommittedWork error with this description.

A callout was unsuccessful because of pending uncommitted work related to a process, flow, or Apex operation.
Commit or roll back the work, and then try again.

To avoid this error, execute DML operations and queries in separate, asynchronous calls.

## Fields

| Field Name | Details |
| --- | --- |
| Handle | 
Type

string

Properties

Filter, Nillable, Sort

Description

The username in the third-party system.



 |
| IsNotSsoUsable | 

Type

boolean

Properties

Defaulted on create, Filter, Sort

Description

Support for single sign-on.

If true, the link can't be used for a single sign-on flow. It's only available OAuth access and refresh tokens.





 |
| Provider | 

Type

string

Properties

Filter, Nillable, Sort

Description

The third-party account provider name.



 |
| RemoteIdentifier | 

Type

string

Properties

Filter, Nillable, Sort

Description

The unique ID for the user in the third-party system.



 |
| SsoProvider | 

Type

AuthProvider

Properties

Filter, Nillable, Sort

Description

The foreign key to the [AuthProvider](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_authprovider.htm "Represents an authentication provider (auth provider). An auth provider lets users log in to your Salesforce org from an external service provider, such as Facebook, Google, or GitHub. This object is available in API version 27.0 and later.") of the third-party system.



 |
| SsoProviderId | 

Type

reference

Properties

Filter, Nillable, Sort

Description

The ID associated with the SsoProvider value.

This is a relationship field.

Relationship Name

SsoProvider

Relationship Type

Lookup

Refers To

AuthProvider



 |
| SsoProviderName | 

Type

string

Properties

Filter, Nillable, Sort

Description

The name associated with the AuthProvider of the third-party system, in case the user has no access to the provider foreign key (the SsoProvider value).



 |
| ThirdPartyAccountLinkKey | 

Type

string

Properties

Filter, Nillable, Sort

Description

A concatenated string including the organization ID, the SsoProviderId value, the SsoProvider value, and the RemoteIdentifier value.



 |
| UserId | 

Type

reference

Properties

Filter, Nillable, Sort

Description

The Salesforce user associated with this third-party account link.

This is a relationship field.

Relationship Name

User

Relationship Type

Lookup

Refers To

User



 |

## Usage

Admins (with the Manage Users permission) querying this object can see all the links for all users in the organization. Without the Manage Users permission, users can only retrieve their own links. Users sometimes don't have access to the SsoProvider value (the foreign key). In this case, use the SsoProviderName to render the name of the provider for the associated link.

Use the Apex method Auth.AuthToken.revokeAccess() to revoke a link. To use this method, the IsNotSsoUsable field must be false.

To make the ThirdPartyAccountLink standard object writable for Salesforce admins, contact Salesforce Customer Support. With this feature, you can easily add or delete third-party account links using the API, but you can’t update existing account links.

In API version 34.0 and later, this object was enhanced to help manage high instance counts. A query() call returns up to 500 rows. A queryMore() call returns 500 more, up to 2,500 total. No more records are returned after 2,500. To make sure that you don’t miss any records, issue a COUNT() query in a SELECT clause for ThirdPartyAccountLink. This query gives you the total number of records. If there are more than 2,500 records, use these options to manage your results.

- Divide queries by filtering on fields like UserId to return subsets of less than 2,500 records.
- Use [OFFSET](https://developer.salesforce.com/docs/atlas.en-us.264.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_offset.htm) to get batches of 2,000 records. Start with an OFFSET of 0 and then increment by 2,000. If you use this option, we recommend that you also use [LIMIT](https://developer.salesforce.com/docs/atlas.en-us.264.0.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_limit.htm) to limit each query to 2,000.
    
    ![Note](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png)
    
    #### Note
    
    The OFFSET clause is limited to 2,000 rows. Requesting an offset greater than 2,000 results in a NUMBER\_OUTSIDE\_VALID\_RANGE error.
    
    For example, use an initial query with this structure.
    
    SELECT <desired fields> FROM ThirdPartyAccountLink LIMIT 2000 OFFSET 0
    
    Then, run another query with an offset of 2,000.
    
    SELECT <desired fields> FROM ThirdPartyAccountLink LIMIT 2000 OFFSET 2000
    
    Continue to increase the offset by 2,000 until you have results for all records.