No, check-sso is used to check if user is already logged into Keycloak
server and in that case, he will be automatically logged into your
javascript application. In case of anonymous access, user is not forced
to login.
Marek
On 24.6.2015 16:49, Juan Diego wrote:
I am allowing anonymous users, would the check-sso force my users to
log?
On Wed, Jun 24, 2015 at 2:35 AM, Marek Posolda <mposolda(a)redhat.com
<mailto:mposolda@redhat.com>> wrote:
You have option to pass the tokens from local storage to the
'init' method of keycloak object. For example you can use
something like:
keycloak.init({
token: 'yourAccessToken',
refreshToken: 'yourRefreshToken',
idToken: 'yourIdToken'
});
Another option is to not store anything in localStorage, but
instead after refresh the page re-authenticate the user again.
User won't need to login again and provide username/password,
because he should be logged automatically due to SSO (unless
session is expired). This is what our admin console and examples
are doing. Feel free to check them, especially angular example:
https://github.com/keycloak/keycloak/tree/master/examples/demo-template/a...
Marek
On 23.6.2015 20:06, Juan Diego wrote:
> Hi,
>
> After my user logs I am saving the token to a localstorage. I am
> using angularjs by the way.
>
> So if my user refreshes the page they still have the session. As
> far as I can tell when you refresh the page, most of the info of
> the object keycloak is null, except for the realm and all the
> stuff you get form keycloak.json. Like if you have never logged.
>
> So I stored the token in my localStorage.
>
> I am thinking 3 options basically.
>
> 1)
> Setting keycloak.token = localStorage.get("token"), and I was
> trying to look for a function in that object to retrieve all the
> other data, but I couldnt find any on the documentation and
> looking at my console.log(keycloak)
>
> 2)
> Storing the whole object keycloak in localstorage, the problem
> with this is that it will only store the properties and obviously
> not the functions, so I was thinking that I should manually set
> all the properties like this
>
> clientId= localStorageService.get('keycloak').clientId;
> idToken= localStorageService.get('keycloak').idToken;
> idTokenParsed= localStorageService.get('keycloak').idTokenParsed;
> realmAccess= localStorageService.get('keycloak').realmAccess;
>
> 3) Just check everything against the localstorage instead.
> But I wont be able to use the functions from the object keyclaok, like
updateToken.
>
> I am kind of new to angular, as you can see too.
>
> Thanks,
>
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user(a)lists.jboss.org <mailto:keycloak-user@lists.jboss.org>
>
https://lists.jboss.org/mailman/listinfo/keycloak-user