I'm looking for enlightenment in regards to request headers and response headers.
Below taken from some google article
Request headers contain more information about the resource to be fetched, or about the client requesting the resource. Response headers hold additional information about the response, like its location or about the server providing it.
I'm trying to get a Bearer Token from a logged in User. The token in the newBearer is one I need. It has all the information, but my problem is the Request header has a Authorization Bearer and the response header has a Authorization: New Bearer. Which one is the correct one to take?
Can you take newBeaer token? cause when I do I get a lot of complaints with the below code.
When I just take the Authorization it works fine.
import { Injectable } from '@angular/core';
@Injectable()
export class TokenInterceptorService implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
let token = req.headers.get('Authorization');
let parsedToken = token.slice(7) /// which gives me my long token
localStorgae.setItem('token', parsedToken ) /// set in storage to decode later on
return next.handle(req);
}
}
Should I be taking the token from the response or request headers?