[keycloak-dev] Keycloak and Angular, how to login after angular has been bootstrapped

Stian Thorgersen sthorger at redhat.com
Thu Jan 21 02:48:23 EST 2016


We could do with a proper Angular wrapper, but without it you have to let
Keycloak initialize first, then have Keycloak initialize Angular. Take a
look at:
https://github.com/keycloak/keycloak/blob/master/examples/demo-template/angular-product-app/src/main/webapp/js/app.js#L23

Just remove { onLoad: 'login-required' } and it won't automatically login,
instead you run login() to login.

On 20 January 2016 at 21:46, replymenot <replymenot at gmail.com> wrote:

> Hi all,
>
> Recently I attended a seminar on Keycloak and I was totally blown away.
> Loved it and it seems to be exactly what I need for my microservices
> architecture.
> I use AngularJS as my front-end and I have this burning question.
>
> How can I use Keycloak as security provider in a SPA after the angular app
> has already been bootstrapped?
>
> The website I’m creating has anonymous and role based secure parts. So I
> only want login based on context and not on load.
> I can’t seem te be able to find examples.
> Right now I get the login from keycloack but after redirect my angular app
> is re-bootstrapped and I loose my login, because it is not part of my
> single page app...
>
> Help will be appreciated.
>
> Ivo.
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20160121/f4f6a2fb/attachment.html 


More information about the keycloak-dev mailing list