+ .catch((res: Response) => {
+ // The refresh token is invalid?
+ if (res.status === 400 && res.json() && res.json().error === 'invalid_grant') {
+ console.error('Cannot refresh token -> logout...');
+ this.logout();
+ this.router.navigate(['/login']);
+
+ return Observable.throw({
+ json: () => '',
+ text: () => 'You need to reconnect.'
+ });
+ }
+
+ return this.restExtractor.handleError(res);
+ });