December 7, 2020

How to remove Third-Party Account Links in Salesforce?

Sample Code:

String authProviderId = '';//Provide the Auth. Provider Id
String strUserId = '';//Provide the User Id

ThirdPartyAccountLink objTPAL = [ SELECT RemoteIdentifier FROM ThirdPartyAccountLink WHERE UserId =: strUserId ];

//For Facebook use facebook, for Google use google
Boolean checkBool = Auth.AuthToken.revokeAccess( authProviderId, 'open id connect', strUserId, objTPAL.RemoteIdentifier );
system.debug( 'Output Is ' + checkBool );

No comments:

Post a Comment