title: Keycloak Angular Cannot read property 'resourceAccess' of undefined
body: <p>i want to trying few rule with keycloak auth.
  i need 2 route, someone "newsite" other "list"</p>
  
  <p>We creating a site as free. But you cant see list of sites without auth. But given this error:</p>
  
  <pre><code>ERROR Error: Uncaught (in promise): An error happened during access validation. Details:TypeError: Cannot read property 'resourceAccess' of undefined
      at resolvePromise (zone-evergreen.js:793)
      at resolvePromise (zone-evergreen.js:752)
      at zone-evergreen.js:854
      at ZoneDelegate.invokeTask (zone-evergreen.js:400)
      at Object.onInvokeTask (core.js:41249)
      at ZoneDelegate.invokeTask (zone-evergreen.js:399)
      at Zone.runTask (zone-evergreen.js:168)
      at drainMicroTaskQueue (zone-evergreen.js:570)
  </code></pre>
  
  <p>How can I fix this issue/problem ?</p>
  
  <p>My code samples here(only relevant to this):</p>
  
  <pre><code>  {path: 'newsite',component: NewsiteComponent},
    {path:'list',component:ExamplelistComponent,canActivate: [AppAuthGuard]},
  
  
   providers: [{
    provide: KeycloakService,
    useValue: keycloakService
  }],
  
  
  export class AppModule implements DoBootstrap {
  async ngDoBootstrap(appRef: ApplicationRef) {
  try {
    await keycloakService.init({ config: environment.keycloak });
    appRef.bootstrap(AppComponent);
  } catch (error) {
    console.error("Keycloak init failed", error);
  }
  </code></pre>
  
  <p>}
    }</p>
  
  <p>Versions:</p>
  
  <blockquote>
    <p>keycloak-angular npm: "^7.2.0",</p>
    
    <p>Keycloak server : docker keycloak:9.0.0</p>
    
    <p>Angular 8</p>
  </blockquote>
  
  <p>Helper blogs/pages:</p>
  
  <p><a href="https://medium.com/@sairamkrish/keycloak-integration-part-2-integration-with-angular-frontend-f2716c696a28" rel="nofollow noreferrer">https://medium.com/@sairamkrish/keycloak-integration-part-2-integration-with-angular-frontend-f2716c696a28</a> </p>
  
  <p><a href="https://github.com/mauriciovigolo/keycloak-angular/tree/angular7-keycloak3/examples/keycloak-heroes/src/app" rel="nofollow noreferrer">https://github.com/mauriciovigolo/keycloak-angular/tree/angular7-keycloak3/examples/keycloak-heroes/src/app</a></p>