[keycloak-user] Getting currently logged in user -Angular JS

Rushil Agarwal rushil.vaish at gmail.com
Mon Dec 7 07:46:18 EST 2015


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 at 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 at 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
>> Mobile: +91 78298 86000
>>
>> Please don't print this e-mail unless you really need to. SAVE PAPER TO
>> SAVE TREES
>>
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151207/60e38329/attachment.html 


More information about the keycloak-user mailing list