How do I guarantee a logged in session for a new service portal

Joey Wan Kenobi
Tera Guru

If i provide a link to the homepage a service portal i created, how can i guarantee that the user session actually begins?

I have server scripts that check for information about the user's session (gs.hasRole, gs.getUserID()), but they dont work if the session doesnt actually begin. The links to the page just bring the user to the page without logging them in.  

1 ACCEPTED SOLUTION

A HI ticket did the trick. I had to set the public page for $sp to false IN ADDITION to setting the public page for $my_new_service_portal to false (i had only performed the latter, not thinking that $sp would have any bearing on the other portal).



Now, any direct link to one of the pages on $my_new_service_portal will log the user in via SSO first (if they aren't already) and then route them to the requested page.



Thanks again for your help.


View solution in original post

11 REPLIES 11

Chuck Tomasi
Tera Patron

Have you thought about using gs.getSession().isLoggedIn() in the server script?



http://wiki.servicenow.com/index.php?title=GlideSession#isLoggedIn.28.29


I'm sorry. i should be more clear.



Your suggestion will merely tell me that they are logged in.



I am looking for a way to make sure it happens.


Sorry for the confusion...



I am looking for a way to make sure it happens.


Make sure what happens exactly?


Make sure that user logs in, not just checks that they are logged in