I would like to customize community login page. At the same time I have enabled SSO authentication for the community.

Is it possible to add "SSO Login button" to the custom login page?


Refer this link where it says

Login to Salesforce Org where the custom domain was configured as a Salesforce Administrator and navigate to Setup>>Domain Management>>My Domain. Once the "My Domain" page loads scroll down to the section titled "Login Page Branding" and click edit. Next to the "Authentication Service" section there are two check boxes Login Page and IdentityConnect. Ensure the IdentityConnect checkbox is checked if not check it and Save. Checking this box enables the Identity Connect SSO (Single Sign On) button to show on the domain login screen.

  • In this case a SSO login button will be added to the My Domain standard login page. In my case we do not use My Domain functionality. We only use Communities. – steals Jan 22 '15 at 11:28

Find the answer by myself.
Go to the Setup -> Single Sign-On Settings
Open required SSO configuration and copy "Identity Provider Login URL" value.
Add regular apex:commandButton and action in the controller that returns Page reference to the "Identity Provider Login URL"


Better to use the getSamlSsoUrl from the AuthConfiguration class:

String communityUrl = '<Site URL of the Community>';
String startUrl = '/s';

Auth.AuthConfiguration authConfig = new Auth.AuthConfiguration(communityUrl, startUrl);

List<SamlSsoConfig> samlConfigList = [SELECT DeveloperName, Id FROM SamlSsoConfig WHERE DeveloperName = : 'SSO Unique Name'];
Id samlId = samlConfigList[0].Id;

String sso = Auth.AuthConfiguration.getSamlSsoUrl(communityUrl, startUrl, samlId);

New contributor
Dmitry Zhugin is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.