CODE: Login Buttons/App Setup
Code and procedure to add custom single sign-on and non-single sign-on buttons to an app

If setting up a Knack App for the first time, you will need all the JS & CSS included in this documentation. For simplicity, copy and paste the two code blocks below onto their respective code pages in Knack.
JS Overview
This code will replace the default Knack single sign-on button and login form shown below with the buttons shown above. In the above experience, the form shown below will only appear if a user clicks the button titled Non-COA Sign-In.

Include the following 2 sections of JS in your app if they are not already present. They are required.
The JS - SSO Function & Render
The purpose of this code is to find the Knack default single-sign on button and its Knack view ID in the DOM, replace the button with the buttons shown above, and then hide the default Knack login form unless the user clicks the Non-COA Sign-In button.
The JS - Big Button Function
This allows for creation of any big buttons in your app. The 'customizeLoginButton' function above does require this function to render the big button.
CSS Overview
Include the following 3 sections of CSS in your app if they are not already present. They are required.
The CSS - FA Icon Positioning
This styles the FA Icons in your app so that they are positioned appropriately on a text line. By applying 'baseline' to the 'vertical-align' property of a standard font awesome icon, icons will appear centered with button text.
The CSS - Big Buttons
This styles the bigger Sign-In button. Do not duplicate this code if already in your app. This CSS will also apply to other Big Buttons you may place in your app.
The CSS - Small Buttons
This styles the smaller Non-COA Sign-In button. Do not duplicate this code if already in your app. This CSS will also apply to other Small Buttons you may place in your app.
Last updated
Was this helpful?