aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-main/auth/auth-interceptor.service.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts
index 4fe3b964d..5bcad36d0 100644
--- a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts
+++ b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts
@@ -5,6 +5,7 @@ import { Injectable, Injector } from '@angular/core'
5import { AuthService } from '@app/core/auth/auth.service' 5import { AuthService } from '@app/core/auth/auth.service'
6import { Router } from '@angular/router' 6import { Router } from '@angular/router'
7import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 7import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
8import { OAuth2ErrorCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models/server'
8 9
9@Injectable() 10@Injectable()
10export class AuthInterceptor implements HttpInterceptor { 11export class AuthInterceptor implements HttpInterceptor {
@@ -25,7 +26,9 @@ export class AuthInterceptor implements HttpInterceptor {
25 return next.handle(authReq) 26 return next.handle(authReq)
26 .pipe( 27 .pipe(
27 catchError((err: HttpErrorResponse) => { 28 catchError((err: HttpErrorResponse) => {
28 if (err.status === HttpStatusCode.UNAUTHORIZED_401 && err.error && err.error.code === 'invalid_token') { 29 const error = err.error as PeerTubeProblemDocument
30
31 if (err.status === HttpStatusCode.UNAUTHORIZED_401 && error && error.code === OAuth2ErrorCode.INVALID_TOKEN) {
29 return this.handleTokenExpired(req, next) 32 return this.handleTokenExpired(req, next)
30 } 33 }
31 34