Need help on authenticationChallenge

I am trying to implement the ability to limit a user to one session as in Keep users from logging in on multiple devices - #23 by Eagel007. Comment 22 mentions using authenticationChallenge with forceAuth = True.

I implemented the Perspective Startup event script as shown:

In the log I see the script runs, but on the authenticationChallenge instruction I have an error:

It looks like the fundamental issue in the error message is "No perspective page attached to this thread."

How do I fix this?

(complete text of error code below)

log_authenticationchallenge.txt (4.3 KB)

I think you have to pass the request from the session script via message handler to the perspective side before it gets the perspective context to be able to call it?

1 Like

David, thanks for the reply. Can you show me the steps for making this work? I thought that a Perspective Startup script would already be on the Perspective side. Do I have the authenticationChallenge in the wrong place?

Yes. Anything in Perspective that does navigation or opens/closes popups needs to run in page scope, not just session scope. Consider running this in a global docked view.

2 Likes

Perhaps I am not understanding. The Session Startup Script is not doing navigation or opening/closing popups. It is trying to force authentication every time a user starts a Perspective session, even if they are logged in on another session. Do I need to move this to a View onStatup script for the designated home page instead?

Authentication counts as navigation because the browser has to navigate to the IdP. So yes, move it to a view startup or related event. (Docks are good choices because they don't come and go.)

1 Like

Well, looks like I can't put it in a view onStartup script. I am not sure where this should go now.

Does it go on the 'root' onStartup script?

Nope, same error on 'root' onStartup script

"Designer sessions do not support auth challenges."

Don't attempt the auth challenge when already authenticated, to avoid loops and to avoid designer incompatibility.

You can only test a project's IdP in a proper client session.

1 Like