title: Silent refresh not working with OIDC-client in Angular 5
body: <p>I have an issue with the silent refresh with <a href="https://www.npmjs.com/package/oidc-client" rel="nofollow noreferrer">oidc-client</a>.
  The signin works fine and I'm able to acquire a token.
  However, the silent refresh doesn't fire, nothing happens. When I subscribe to methods that check token expiry (methods in <code>subscribeevents</code> in authservice.ts below), these methods never fire - and the method <code>isLoggedIn()</code> always return true even if the token has expired.</p>
  <p>Here is my code :</p>
  <pre class="lang-js prettyprint-override"><code>import { Component, OnInit } from '@angular/core';
  import { UserManager } from 'oidc-client';
  import { getClientSettings } from '../openIdConnectConfig';
  import { AuthService } from '../services/auth.service';
      
  @Component({
      selector: 'app-silentrefresh',
      templateUrl: './silentrefresh.component.html',
      styleUrls: ['./silentrefresh.component.css']
  })
  export class SilentRefreshComponent implements OnInit {
      constructor(private _authService:AuthService) {
      }
      
      ngOnInit() {
          this._authService.refreshCallBack();
      }
  }
  </code></pre>
  <p>Then my authservice :</p>
  <pre class="lang-js prettyprint-override"><code>import { UserManagerSettings, UserManager, User } from 'oidc-client';
  import { Injectable } from '@angular/core';
  import { getClientSettings } from '../openIdConnectConfig';
      
  @Injectable()
  export class AuthService {
  
      private _manager = new UserManager(getClientSettings());
      private _user: User = null;
  
      constructor() {
          this._manager.getUser().then(user =&gt; {
              this._user = user;
          });
  
          this._manager.events.addUserLoaded(user =&gt; {
              this._user = user;
          });
  
          this.subscribeevents();
      }
  
      public isLoggedIn(): boolean {
          return this._user != null &amp;&amp; !this._user.expired;
      }
  
      public getClaims(): any {
          return this._user.profile;
      }
  
      public subscribeevents(): void {
          this._manager.events.addSilentRenewError(() =&gt; {
              console.log(&quot;error SilentRenew&quot;);
          });
  
          this._manager.events.addAccessTokenExpiring(() =&gt; {
              console.log(&quot;access token expiring&quot;);
          });
  
          this._manager.events.addAccessTokenExpired(() =&gt; {
              console.log(&quot;access token expired&quot;);
          });
      }
  
      public refreshCallBack(): void {
          console.log(&quot;start refresh callback&quot;);
          this._manager.signinSilentCallback()
              .then(data =&gt; { console.log(&quot;suucess callback&quot;) })
              .catch(err =&gt; {
                  console.log(&quot;err callback&quot;);
              });
          console.log(&quot;end refresh callback&quot;);
      }
  
      getUser(): any {
          return this._user;
      }
  
      getName(): any {
          return this._user.profile.name;
      }
  
      getAuthorizationHeaderValue(): string {
          return `${this._user.token_type} ${this._user.access_token}`;
      }
  
      startAuthentication(): Promise&lt;void&gt; {
          return this._manager.signinRedirect();
      }
  
      completeAuthentication(): Promise&lt;void&gt; {
          return this._manager.signinRedirectCallback().then(user =&gt; {
              this._user = user;
          });
      }
  }
  </code></pre>
  <p>And my config:</p>
  <pre class="lang-js prettyprint-override"><code>import { UserManagerSettings } from &quot;oidc-client&quot;;
  
  export function getClientSettings(): UserManagerSettings {
      return {
          authority: 'https://login.microsoftonline.com/136544d9-038e-4646-afff-10accb370679',
          client_id: '257b6c36-1168-4aac-be93-6f2cd81cec43',
          redirect_uri: 'http://localhost:4200/auth-callback',
          //redirect_uri: 'https://demoazureadconnectangular5.azurewebsites.net/auth-callback',
          post_logout_redirect_uri: 'http://localhost:4200/',
          //post_logout_redirect_uri: 'https://demoazureadconnectangular5.azurewebsites.net/',
          response_type: &quot;id_token&quot;,
          scope: &quot;openid profile&quot;,
          filterProtocolClaims: true,
          loadUserInfo: true,
          automaticSilentRenew: true,
          silent_redirect_uri: 'http://localhost:4200/assets/silentrefresh',
          metadata: {
              issuer: &quot;https://sts.windows.net/136544d9-038e-4646-afff-10accb370679/&quot;,
              authorization_endpoint: &quot;https://login.microsoftonline.com/136544d9-038e-4646-afff-10accb370679/oauth2/authorize&quot;,
              token_endpoint: &quot;https://login.microsoftonline.com/136544d9-038e-4646-afff-10accb370679/oauth2/token&quot;,
              //jwks_uri: &quot;https://login.microsoftonline.com/common/discovery/keys&quot;,
              jwks_uri: &quot;http://localhost:4200/assets/keys.json&quot;,
              //jwks_uri: &quot;https://demoazureadconnectangular5.azurewebsites.net/assets/keys.json&quot;,
              //jwks_uri: &quot;http://localhost:50586/api/keys&quot;,
              signingKeys: [{ &quot;ApiAccessKey&quot;: &quot;NgixniZ0S1JHxo7GPEZYa38OBTxSA98AqJKDX5XqsJ8=&quot; }]
          }
      };
  }
  </code></pre>
  <p>I also tried to use a static page like this:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;script src=&quot;oidc-client.min.js&quot;&gt;&lt;/script&gt;
      &lt;script&gt;
          var usermanager = UserManager().signinSilentCallback()
              .catch((err) =&gt; {
                  console.log(err);
              });
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  <p>It's never fired neither</p>
  <p>In order to test, I've changed the ID token expiry to 10 min.
  I use Azure AD Connect (Open Id Connect in Azure) and Microsoft says it's not fully compatible with Open ID Connect standard... So I don't know if it's on my side or Azure side.</p>
  <p>Somebody can help me to solve this?</p>