Put in order · Angular course · Module 9: HttpClient
Building an Authorization Interceptor
Order the consecutive lines inside an interceptor that adds a token:
Items to put in order
- headers: req.headers.set('Authorization',
Bearer ${token}) - const authReq = req.clone({
- const token = inject(AuthService).getToken();
- return next(authReq);
- });
You can check the correct answer by solving this task in the CodeWorlds game.