Unknown or invalid refresh token error

It seems that this error appear when the refresh token has expired or has been invalidated.
To fix this issue, I use the following code in my app.component

this._auth.error$.pipe(
      takeUntil(this._destroy$),
      filter((e) => e instanceof GenericError && (e.error === 'login_required' || e.error === 'invalid_grant')),
      mergeMap(() => this._auth.logout({
          logoutParams: {
            returnTo: '<logoutUrl>'
          }
        }))
    ).subscribe();
1 Like