logo

NJP

Redirect unauthenticated users to login page for Virtual Agent on Web App and Embed App

Import · Jun 24, 2020 · article

Hi All,

The web client and Embedded client is by default accessible publicly (even for unauthenticated users) even though the topics are not made public.

This article focuses on how to make this web client interface non-public such that it redirects users to login before proceeding further with virtual agent chat.

Firstly, To ensure unauthenticated users to get redirected to login page when this standalone URL is accessed.

  • The page to focus on is $sn-va-web-client-app.
  • Under Application Navigator, navigate to System Definition > Public Pages. (If you don't see this module, please check Additional Information below)
  • Look for the record under Page field/column with the above name.
  • You will notice that Active field is set to true.
  • Set it to false.

Note: If the page doesn't exist create a new one. Ex. sn_va_web_client_app_embed is not present OOB

Secondly, you have to

  • Navigate to System Definition > Script Includes
  • Find the "SAML2_update1" script include.
  • Find the following piece of code in the script field:
    needNavFrame: function(requestURI, request)
  • Add the following if condition inside needNavFrame to remove the navpage from the virtual agent standalone client:

`if (requestURI.indexOf("sn-va-web-client-app") >= 0){return false;

}

`

Note: For embed client add the following line of code

`if (requestURI.indexOf("sn_va_web_client_app_embed") >= 0){return false;

}

`

Please mark this article helpful if it helped you.

Cheers,

Hardit Singh

View original source

https://www.servicenow.com/community/virtual-agent-nlu-articles/redirect-unauthenticated-users-to-login-page-for-virtual-agent/ta-p/2308893