It seems that what you need is to call keycloak.init with 'check-sso' flag. Something like this:

keycloak.init({ onLoad: 'check-sso' })

See docs for some more details http://keycloak.github.io/docs/userguide/keycloak-server/html/ch08.html#javascript-adapter .

With the 'check-sso' option, the javascript adapter will try to redirect to KEycloak server and see if user was already logged-in to keycloak through SSO (which is the case after successful registration). If he is logged, the keycloak will redirect back to application with the login success (code+state) and javascript application will be logged-in automatically.

Marek

On 02/05/16 15:12, JAYAPRIYA ATHEESAN wrote:

Hi Team,

 

We have UI written in angular JS. We have integrated the same with keycloak for authentication and authorization.

When we follow the reset password link, a mail is sent to the associated user’s email id. When I click on the link sent for password reset, a page opens up for providing new password.

 

After I submit the password change request, the application just changes the password. But the problem is that, it does not login to our application dashboard. If we click on login button, the user gets logged in.

 

How to make the application seamlessly go to the dashboard? By going through the files shared by your team in example, we see that we cannot capture the onsuccess.

 

Onlogin method goes through, but it is not being redirected. Is it possible to  specify the url to be redirected after successful password reset?

 

The flow reaches the below part

 

var kInit = function () {

 

        keycloakAuth.init().success(function () {

            $rootScope.keycloak = keycloakAuth;

            console.log('token = ' + keycloakAuth.token);

        }).error(function () {

            //console.log("failed to intialize");

        });

    };

 

    kInit();

 

 

We expect that the flow should go through the below method also, but it doesn’t happen.

 

keycloakAuth.onAuthSuccess = function () {

        $rootScope.authLogin = true;

        console.log('coming in auth success');

        loginService.login(keycloakAuth);

        $rootScope.dataloading = true;

       

    };

 

Thanks,

Jayapriya Atheesan

 



_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user