Portal Login Not Working

Sam Ogden
Tera Guru

Hi All,

The login button on the menu on the portal I am configuring is not taking me to a login page for the portal but instead re-directing me to the login page for the desktop SN instance.   Not sure what configuration I am missing.

find_real_file.png

find_real_file.png

find_real_file.png

I am expecting to get a popup login menu similar to this on the portal:

find_real_file.png

If I click on either the Raise and Incident or Submit Request button it takes me to a login page as expected.

Any help on what configuration I am missing will be greatly appreciated

Thanks

7 REPLIES 7

Community Alums
Not applicable

Sam,



We do this with a global UI script. I don't think I'm allowed to share the whole script, but I can show you the important bits:



First, you make the UI script global, and you wrap the entire script in this function:



        addLateLoadEvent(function()


        {


        ....


        }



This makes sure that the script is run as soon as the rest of the page is loaded. if you use any method that fires before this point in the page load, you wont have access to the objects you need to use. (g_user will be undefined, for example)



Next, you need something that determines to which class of user the logged in user belongs, and you need to determine what page they're on.


Once you have that, you just do a simple comparison via if/else to determine whether they need to be redirected or not.



Finally, when you've defined your logic, you need to redirect them:


       


        window.top.location.href = baseUrl + '<YOUR_PORTAL>';



where you replace <YOUR_PORTAL> with the id for the portal in question, and baseURL is defined as follows:



        var baseUrl = window.location.protocol + '//' + window.location.host;



Like i said, this works, we have it in production today.


I think the above makes sense, might need some help with the code when I try to implement it, but will cross that bridge later.



When you I'll need to determine the class of user, do you mean determine which portal instance they should have access to by checking for example the users company?



currently when you go to one of our portals they go to the homepage which has been set up like below:



find_real_file.png


Would it be better to have it so when they go to the url it goes to a login page first ?



Thanks for all your help so far.


This is a Problem discussed in the KB article - ServiceNow KB: User is redirected to platform login from CSM portal - reproducible only with "Custom...



There is a work around given in the KB article. Click helpful if this works.