Is there a way to hook the login event post authentication and redirect to a new page?

Under certain circumstances, we would like to redirect the user to a different page from the gateway context immediately after the login event.

The com.inductiveautomation.perspective.gateway.session.InternalSession interface has an onSessionInit event method that include a response parameters but no return value. Does any know how to override this hook or of a definition for this JSON parameter or how we might use it to do a redirect? (or a better way to do this in the sdk?)

You can't 'hijack' Ignition's IdP, no. Potentially we could expose this as a hook if a compelling enough use case was given, but this seems pretty niche. You could 'roll your own' Identity Provider, or use an off-the-shelf third party tool that gave you this capability, perhaps.

Is onSessionInit part of the Idp? Ideally, I would want to redirect to a new page in the same way the Idp redirects to the login page, but after the authentication completes. (I need the session info to be initialized before any decision to redirect can be made.)

Think about it this way: I want to add a session.onStartup event script (which is easily accomplished on the python side of things), except do it in my module. I think that what's possible in python must also be possible in the java module - is that right?

Actually, it looks like there's no event posted anywhere to indicate that a new session was created. You can add listeners to an existing session that would be fired every time the authentication status changes, but you can't have an event based hook for each new Perspective session. That's probably something we should fix; there's no real reason not to have it available for purposes like this.

In the meantime, expose a scripting function that can be called from session startup event scripts in every project. This would give you a chance to track/initialize the session for your module's purposes.

The session startup event, is not fired when authenticating. Or have I misunderstood this ? I'm also looking for a way to grab the user after a successful login, and have a redirect based on some params.

Session startup is before authentication. Have you tried a propertyChange event on the session's auth properties?