Angular Auth0 Interceptor setting req.body values to null on POST

I implemented the Angular SPA quickstart in a Angular 9 app (

The interceptor correctly sets the Authorization header for all HTTP method types.

However, for POST types, the req.body values for all keys are set to null in the this.auth.getTokenSilently$().pipe( ... method

If I console.log the req.body before the this.auth.getTokenSilently$().pipe( ... method, the req.body has the expected values.

Can anyone shed some light on why this issue is occurring?

(the console.log in the screengrabs incorrectly mention switchMap as I also tried switchMap, it should have read mergeMap)

import { Injectable } from '@angular/core';
import {
} from '@angular/common/http';
import { AuthService } from './auth.service';
import { Observable, throwError } from 'rxjs';
import { mergeMap, catchError, map, concatMap, switchMap } from 'rxjs/operators';

  providedIn: 'root'
export class InterceptorService implements HttpInterceptor {

  constructor(private auth: AuthService) { }

    req: HttpRequest<any>,
    next: HttpHandler
  ): Observable<HttpEvent<any>> {

    console.log('pre switchmap req.body', req.body);

    return this.auth.getTokenSilently$().pipe(

      mergeMap(token => {

        console.log('switchMap req.body', req.body);

        const tokenReq = req.clone({
          setHeaders: { Authorization: `Bearer ${token}` }

        return next.handle(tokenReq);

      catchError(err => throwError(err))


Hey there!

Can I ask you to raise it as a GitHub issue in the qucikstart repo so we can work on that directly with the repo maintainers? Thank you! Make sure to share the link with us so we can ping them.

Thanks @konrad.sopala

Issue posted here:

1 Like

Thank you! I will ping repo maintainers in a few minutes

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.