Changing Perspective Project from Session

When going from one project to another in Perspective, the previous project still shows up in the Perspective Sessions in the Gateway. So now the user has 2 sessions open for 2 different projects.

I am using Ignition as the IdP. I am wanting the old session to close. That’s not the bigger problem I’m trying to solve.

Our project flow goes from Project A to B then to C. Most time is spent in C right now. Later we will have the flow be Project A to B to C or D or E, etc.
When calling the function system.perspective.logout(), it logs the user out of the current session (C) but the previous project session (B).
That all said, I need the user to click the logout button from project C and then get redirected to project A.

I’ve tried calling the logout function then the navigate code, that doesn’t work.
Also, I’ve tried to call the navigate function first then logout and that doesn’t work either.
The session just stays at the Ignition logout screen with the button that says back.

Any suggestions on how to achieve this?

Navigating in and out between projects is always going to be difficult - even more so when you need ot maintain control over authentication status.

As you move from one project to another (let’s say A to B), a new session is created. The user still has a session open in Project A which will timeout based on the settings for the Project (these can be set within the Designer under the “Project” menu bar option).

What I recommend is logging the user out asynchronously:

def log_out_session(sessionId =
    import system

# it is important to do the navigation LAST because the session will not execute any code AFTER the navigation

Thanks, this works great.

As for that timeout (Project Properties → Perspective → General → Session Timeout), what does that mean exactly?

Does that mean the user’s communications with the Gateway? Or the user’s time since interacting with the screen?
I ask because if someone is watching tags update on the screen, they may sit there for an hour or 2 without even interacting with the screen.

It’s an automatic handshake between the frontend session in the browser/app/whatever and the backend on the gateway.
If the frontend disappears, due to comm loss/navigation/whatever else, it has timeout seconds to re-appear before the gateway terminates the session.

In your case, when you make the navigation call to go from project A to project B, the current “open/active” session is for Project B. The session which WAS open for Project A is being maintained for the duration of that timeout setting, just in case the session was disconnected. If the current browser does not open a tab to Project A BEFORE the specified timeout elapses, then the Gateway will automatically terminate the orphaned session.

@PGriffith @cmallonee Thank you for the feedback.

For project A and B in my case, the user will only be in those projects a few seconds, maybe a minute.
Then in project C, where the bulk of the time is spent, project A and B sessions will close within a minute so when the user clicks the logout button, they should be logged out of project C and redirected to Project A.