в заголовки токен, сделал все по мануалу, но гдет наебался
                  
                  
                  Объявляю класс в App.Module
                  
                  
                  export class AddHeaderInterceptor implements HttpInterceptor {
                  
                  
                    intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
                  
                  
                      console.log('I`m Interceptor')
                  
                  
                      // Clone the request to add the new header
                  
                  
                      const clonedRequest = req.clone({ headers: req.headers.set('Authorization', 'Bearer 123') });
                  
                  
                  
                  
                  
                      // Pass the cloned request instead of the original request to the next handle
                  
                  
                      return next.handle(clonedRequest);
                  
                  
                    }
                  
                  
                  }
                  
                  
                  И объявляю в провадйреах его 
                  
                  
                  
                  
                  
                  providers: [
                  
                  
                    ...
                  
                  
                      {
                  
                  
                        provide: HTTP_INTERCEPTORS,
                  
                  
                        useClass: AddHeaderInterceptor,
                  
                  
                        multi: true,
                  
                  
                      }
                  
                  
                    ],
                  
                  
                
точно, через '@angular/common/http'; отправляешь запросы?
Обсуждают сегодня