[keycloak-user] No user data in the access-token

Marek Posolda mposolda at redhat.com
Mon Oct 5 04:05:49 EDT 2015


Hi,

you added a user and then you authenticated with this user to keycloak 
application?

The "nothing here" means that whole variable "session" is null or just 
that name and email are missing in the token? If it's the first case, 
then I suspect that you didn't authenticate user with the Keycloak at 
all. Make sure to mark all the security-constraints URLs into web.xml 
(check the examples for details). If just the name and email is missing 
in the token, then doublecheck if your user has the values you gave to 
him (you can do it in admin console). Other possibility is that your 
client doesn't have protocol mappers, but I don't think error is here as 
name and email protocol mappers are added by default.

Marek


On 05/10/15 06:19, Mai Zi wrote:
> Hi, there
>
> We add a user ( with name and email ) via  the endpoint  : 
>  /admin/realms/demo/users
>
>
> and then we want to get the name and the email  from the accesstoken,
>
>
> KeycloakSecurityContext session = (KeycloakSecurityContext) 
> request.getAttribute(KeycloakSecurityContext.class.getName());
> AccessToken token=session.getToken();
>
>
>
> but nothing there.
>
>
>
>
> Can anyone help on this?
>
>
> T.I.A
>
> Mai
>
>
>
>
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151005/de59b81f/attachment.html 


More information about the keycloak-user mailing list