Need to remove Authorization Bearer in POST Call
Below code didnt remove the authorization bearer which is coming from http interceptors.
Status code: 403 Unauthorized RequestAuthorization header is present, this is not supported
public EMail(Request) {
const headers = new HttpHeaders()
.delete('Authorization', 'Bearer ' + sessionStorage.removeItem('accessToken'));
return this.http.post<Email>(sendMailUrl, request, { headers }).map((data: any) => {
});
If the authorization header gets added in the HTTP intercepter, then you can not 'remove' the token like this. The HTTP intercepter needs to be adjusted.
Go to your intercepter file, which should start something like this:
public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
You can then not add the Authorization header based on the url being called:
if (req.url !== 'your_email_post_url') {
// add authorization header code
}