I have implemented the auth. provider SSO from Facebook.

When I disable a user, I want to delete at the same time the authentication information of Facebook(ex. Third-party account link in User object).

Is it possible? How to way to be implemented in APEX?

  • 1
    I couldn't find any API for this and am presently having to manually click the "Revoke" action on the "Third-Party Account Links" of the User object. Would be interested in API if/when it exists.
    – Keith C
    Dec 4 '13 at 16:20
  • 1
    Definitely post that as an answer @KeithC! The converse of "Third Party Account Links" is also available on user as "Connected Accounts" if a salesforce user is the identity (as opposed to a Facebook user) May 30 '14 at 22:01

An API for revocation of Third Party Account Links was added in Winter 15 (API version 32.0)

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

Winter 15 Release Notes

However, based on limited testing, this does not currently seem to be fully supported from Apex. Some SOQL queries fail with unexpected errors and DML is not supported (confirmed by Salesforce support).

There is now an idea for suporting revocation in Apex.


You can revoke the API Access but you cannot delete it. You can request access from Salesforce to make the object writable which grants access to delete the third-party links.


From SFDC's documentation

revokeAccess(authProviderId, providerName, userId, remoteIdentifier) Revokes the access token for a specified social sign-on user from a third-party service such as Facebook©. Note that querying the ProviderType field on the AuthProvider object sometimes returns a value that differs from the expected provider name value. For example, for Open ID Connect providers, OpenIdConnect is the ProviderType value for the AuthProvider object, but the expected providerName is Open ID Connect. Signature public static Boolean revokeAccess(String authProviderId, String providerName, String userId, String remoteIdentifier)

Parameters authProviderId Type: String The ID of the Auth. Provider in the Salesforce organization. providerName Type: String The proper name of the third party. For all providers except Janrain, the expected values are Facebook Salesforce Open ID Connect Microsoft Access Control Service LinkedIn Twitter Google For Janrain providers, the parameter value is the proper name of the third party used. Yahoo! is an example of a Janrain provider value. userId Type: String The 15-character ID for the user whose access is being revoked. remoteIdentifier Type: String The unique ID for the user in the third-party system (this value is in the associated ThirdPartyAccountLink standard object). Return Value Type: Boolean

The return value is true if the revokeAccess() operation is successful; otherwise false.

Example The following example revokes a Facebook user's access token.

Auth.AuthToken.revokeAccess('0SOxx00000#####', 'facebook', '005xx00000#####', 'ThirdPartyIdentifier_exist214176560#####');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.