Page login infinite loop

Hi,

I am trying to make a perspective application that is public, but when you open a view within that app, it requires login to a certain role and/or userid. II have put the system.perspective.login() call in the startup event for the root of the view. When I open that viewit goes into an infinite loop if I am already logged in. If I do a system.perspective.login(forceAuth=True ), it askss me for my credewntials, and when I supply them, it asks again.

Looking in the log I see a bunch of WebSocket disconnected from session messages. I set

  • gateway.WebAuthSessionImpl
  • gateway.UserAttributeMapper
  • gateway.IdpAdapter

to debug, but nothing from them.

I can log in to this project if set the project to require Authenticated logins, but logging in within the project goes into the infiinite loop.

Any suggestions?

This is likely your source. When you call login, it navigates you to the login page, closing the calling page, and then when you login or navigate back, the page is opened and the startup event calls the login again and the cycle repeats.

Consider adjusting the root container start up to check if there is a currently logged in user. Something along the lines of

if not self.props.auth.user.id:
    system.perspective.login()

You maybe better off configuring view permissions. Right-click on the view and select Configure View Permissions
View Security Video at Inductive University

2 Likes

Basic idea was correct, property not quite right. I did:

if not self.session.props.auth.authenticated:
system.perspective.login()

and that worked great, thanks!

Thanks, I did try that, but I had to have somewhere that the person logs in before they can open the new view, otherwise I would just get a View Denied message