[keycloak-user] Angular 2 with Webpack

Brian Schofield scope022 at gmail.com
Thu Feb 2 10:52:22 EST 2017


@ebondu
I was trying to extract the info in a callback.  Let me know when you push
some big changes I can help test within my project (I'll keep the branch
open).

@keycloak-user
I had to pivot to accomplish integration before end of sprint so I figured
out how to get keycloak-js working within Typescript project using
webpack at 1.14.0.  Modified a few lines of code within a demo example:

https://github.com/keycloak/keycloak/tree/master/examples/demo-template/angular2-product-app/src/main/webapp/app

If anyone is interested in how to accomplish please feel free to message,
it's actually pretty simple and allows you to get away from script tags on
your index.html and bundle the keycloak adapter naturally.  (If I get some
free time ill see if I can publish a demo with webpack)

On Thu, Feb 2, 2017 at 3:28 AM, ebondu <dev.ebondu at gmail.com> wrote:

> @Brian
> I think you are trying to access these vars *before* the Keycloak component
> has been initialized.
> The global approach is to use Observables to be notified when states have
> been updated.
>
> For example, to get the user data, you should subscribe to the
> "authenticatedObserver" and then use the "tokenParsed" field wich contains
> the decoded JWT :
>
> Keycloak.authenticatedObs.subscribe(auth => {
>       if(auth) {
>         console.info(Keycloak.tokenParsed.given_name);
>       }
> });
>
> I will try to provide a basic example and a more detailed documentation
> soon.
>
>
>
> --
> View this message in context: http://keycloak-user.88327.x6.
> nabble.com/keycloak-user-Angular-2-with-Webpack-tp2493p2568.html
> Sent from the keycloak-user mailing list archive at Nabble.com.
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>



-- 
Brian §chofield


More information about the keycloak-user mailing list