Skip to content

Commit 6217f40

Browse files
author
Bernardo
committed
Corrected generated header
1 parent e9fa6e4 commit 6217f40

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/app/authentication/interceptor/authentication.interceptor.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ export class AuthenticationInterceptor implements HttpInterceptor {
1212
constructor(private authenticationService: AuthenticationService) { }
1313

1414
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
15-
let authReq = req;
15+
let authReq;
16+
1617
const token = this.authenticationService.getToken();
17-
if (token != null) {
18-
authReq = req.clone({ headers: req.headers.set(this.tokenHeaderKey, 'Bearer ' + token) });
18+
19+
if (token === null) {
20+
authReq = req;
21+
} else {
22+
authReq = req.clone({ headers: req.headers.set(this.tokenHeaderKey, 'Basic ' + token) });
1923
}
24+
2025
return next.handle(authReq);
2126
}
2227
}

0 commit comments

Comments
 (0)