Alka_Chaudhary
Mega Sage
Mega Sage

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

  1. 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

  1. Update Widget Controller: Add a function to handle SSO redirection using the above script. This ensures users are directed to the IdP for authentication.
  2. Modify HTML: Ensure the SSO button triggers this function.
  3. Verify Sys ID: Confirm you’re using the correct glide_sso_id from 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.

 

Comments
Sai kumar123
Tera Expert

This is really helpful, Thank you

Shashank C
Tera Explorer

Thank You for Your Insightful Article

Shashank C
Tera Explorer

Thank you for your insightful article.

Version history
Last update:
‎09-19-2024 01:46 PM
Updated by:
Contributors