• Look at
  • tokenParsed and idToken, those are both javascript objects and contain all the properties about the user that is mapped in the token  

  • On 7 December 2015 at 13:46, Rushil Agarwal <rushil.vaish@gmail.com> wrote:
    Hi Stian,

    Thanks for the reply.
    I found only one Angular examples at https://github.com/keycloak/keycloak/tree/master/examples/demo-template/angular-product-app

    But in this example also they are not fetching logged in user ID

    I also went through JavaScript adapter documentation where i got to know Subject property of Keycloak can help me  to get the user id but how to write it in code I am not getting. Tried many solutions but not getting userid.

    I am using below code as if now to authenticate through Keycloak.

    var keycloakAuth = new Keycloak('javascript/keycloak.json');
                    keycloakAuth.init({ onLoad: 'login-required' }).success(function () {
                    }).error(function () {
                            });

    Kindly suggest how can i get logged in userid here.

    On Mon, Dec 7, 2015 at 4:03 AM, Stian Thorgersen <sthorger@redhat.com> wrote:
    For Angular app you should use the JavaScript adapter. Please look at our examples, there's a Angular example in there. Also, look at the JavaScript adapter documentation.

    On 7 December 2015 at 10:08, Rushil Agarwal <rushil.vaish@gmail.com> wrote:
    Hi Team,

    I am using Keycloak for Authenticating my Angular web based application.
    Trying to grasp currently logged in user which I am not able to.

    All i know is through KeycloakSecurityContext i may get, but how to use it not sure.

    Kindly help. 
    Thanks in advance..!!


    With best regards :-
    Rushil Agarwal

    Please don't print this e-mail unless you really need to. SAVE PAPER TO SAVE TREES

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




    --
    -- 
    With best regards :-

    Rushil Agarwal

    Mobile: +91 78298 86000

    Please don't print this e-mail unless you really need to. SAVE PAPER TO SAVE TREES