Salesforce Multi Domain Auto Login SSO
Salesforce Multi Domain Auto Login SSO We had a use case where multiple Authentication Providers were configured for a single B2B Site. With more than one Authentication Provider option, the User has to go through the Salesforce Login Screen to choose the correct SSO to initiate the login process. However, the ask is to automate the process based on UserType/Domains or replace the Standard login page with a custom login page. Salesforce has an AuthConfiguration Class to retrieve authentication provider credentials for users to log in to a Salesforce org. Request String startUrl = '/home'; String communityUrl = 'https://xxxx.sandbox.my.site.com/Source/'; String samlId = '0LExxxxxxxxx'; // String ssoUrl = Auth.AuthConfiguration.getSamlSsoUrl(communityUrl, startUrl, samlId); // this will generate a link based on the SSO ID. System.debug ('ssoUrl ' + ssoUrl); here, we can use http/href redirect with ssoUrl. Response https://xxxxx.sandbox.my.site.com/Source/...