I am trying to understando how to use keycloak.js in a web app with angular, I created a button that calls keycloak.login(); and it seems to work I am prompted with keycloaks login form, and it seems to work, I am able to retrieve my username and display it on my page. But when I refresh my page, it seems to loses the token. The idtoken is null or not defined.
Here it is an example of my code,
http://pastebin.com/W0ZHbtUW,