Application is not opening (loginTrusted)

Hi,

I am trying to login using loginService.loginTrusted method.
So i have put the trustedClientPassword in the properties file as mentioned here: https://doc.cuba-platform.com/manual-6.6/login.html

It shows the user has logged in but it does not open the application.

To test the loginTrusted i have extended the login page and used optionGroups, if the user selects the visitor option loginTrusted should be called

My Login Trusted Code

try {
    session = loginService.loginTrusted(login,
        webAuthConfig.getTrustedClientPassword(), Locale.ENGLISH);
} catch (LoginException e) {
    throw new RuntimeException("Unable to login");
}

Am I doing something wrong? Is there perhaps another place i should call the loginTrusted and not in the extended login page?

Hi,

You can use Connection to login externally authenticated user instead of loginTrusted:

((ExternallyAuthenticatedConnection) connection).loginAfterExternalAuthentication(userName, Locale.ENGLISH);

As an example, see https://github.com/cuba-platform/sample-social-login. There in the extended login window you will find usage example: https://github.com/cuba-platform/sample-social-login/blob/master/modules/web/src/com/company/demo/web/login/ExtAppLoginWindow.java#L82

Usually, you have to use loginTrusted directly only if you extend DefaultConnection. It is not recommended due to complexity of the connection life cycle.

HI,
That works,
Thank You