[keycloak-user] Angular 2 with Webpack

ebondu dev.ebondu at gmail.com
Mon Jan 30 11:28:14 EST 2017


Hi Brian,

I just updated the lib to version 0.3.0 so you may have to update you app.

On my side, to try the lib I followed these steps :
- creation of a new app following  angular2-webpack#installing
<https://github.com/preboot/angular2-webpack#installing>  
- adding the lib to the app with the npm command "npm install
@ebondu/angular2-keycloak --save"
- changing the "app.module.ts" file as explained in  readme
<https://github.com/ebondu/angular2-keycloak#usage>  
- *adding a valid keycloak.json in the /src/public folder* (this point is
missing in the readme)
- adapting the "home.component.ts" file as explained in the readme to inject
Keycloak class and initialize it.

When I go to the home page, I am redirected to the KC server.

Here is the modified "home.component.ts" content :

import { Component, OnInit } from '@angular/core';
import { Keycloak } from '@ebondu/angular2-keycloak';

@Component({
  selector: 'my-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

  constructor(private keycloak: Keycloak) {
    // Do stuff
  }

  ngOnInit() {
    console.log('Hello Home');
    this.keycloak.init({onLoad:'login-required'});
  }

}



--
View this message in context: http://keycloak-user.88327.x6.nabble.com/keycloak-user-Angular-2-with-Webpack-tp2493p2523.html
Sent from the keycloak-user mailing list archive at Nabble.com.


More information about the keycloak-user mailing list