Fixing SSO Redirection Issues in Service Portal
New article articles in ServiceNow Community
·
Sep 19, 2024
·
article
When implementing a custom login page in ServiceNow, you might encounter issues with Single Sign-On (SSO) redirection. A common problem is that after users provide their SSO details, they may be unexpectedly logged out instead of being successfully authenticated.
The Problem
- Unexpected Logout: Even if users are redirected correctly, after entering their SSO credentials, they might be logged out instead of being logged in. This issue can occur due to improper handling of the SSO authentication process.
The Solution
To resolve these issues, use the $window.location object to ensure proper redirection and handle authentication correctly. Incorporate the following script into your widget’s client-side controller:
$window.location = "/login_with_sso.do?glide_sso_id=" + <IdentityProviderSysID>;
Replace <IdentityProviderSysID> with the actual Sys ID of your Identity Provider. This script directs users to the SSO login page with the correct IdP configuration and helps manage the authentication process effectively.
Implementation Steps
- Update Widget Controller: Add a function to handle SSO redirection using the above script. This ensures users are directed to the IdP for authentication.
- Modify HTML: Ensure the SSO button triggers this function.
- Verify Sys ID: Confirm you’re using the correct
glide_sso_idfrom your SSO Providers record.
Conclusion
By using $window.location for SSO redirection and ensuring proper handling of the authentication process, you can resolve issues related to incorrect redirection and unexpected logouts. Implementing these changes will provide a smoother and more reliable login experience for users on your custom login page.
https://www.servicenow.com/community/developer-articles/fixing-sso-redirection-issues-in-service-portal/ta-p/3050580