@@ -14,8 +14,9 @@ import {
1414 XSRF_RESPONSE_HEADER ,
1515 DSPACE_XSRF_COOKIE
1616} from '../xsrf/xsrf.constants' ;
17- import { map } from 'rxjs/operators' ;
17+ import { map , tap } from 'rxjs/operators' ;
1818import { Observable } from 'rxjs' ;
19+ import { XSRFService } from '../xsrf/xsrf.service' ;
1920
2021/**
2122 * Server side version of the service to send authentication requests
@@ -28,6 +29,7 @@ export class ServerAuthRequestService extends AuthRequestService {
2829 requestService : RequestService ,
2930 rdbService : RemoteDataBuildService ,
3031 protected httpClient : HttpClient ,
32+ protected xsrfService : XSRFService
3133 ) {
3234 super ( halService , requestService , rdbService ) ;
3335 }
@@ -43,6 +45,7 @@ export class ServerAuthRequestService extends AuthRequestService {
4345 return this . httpClient . get ( this . halService . getRootHref ( ) , { observe : 'response' } ) . pipe (
4446 // retrieve the XSRF token from the response header
4547 map ( ( response : HttpResponse < any > ) => response . headers . get ( XSRF_RESPONSE_HEADER ) ) ,
48+ tap ( ( ) => this . xsrfService . tokenInitialized$ . next ( true ) ) ,
4649 // Use that token to create an HttpHeaders object
4750 map ( ( xsrfToken : string ) => new HttpHeaders ( )
4851 . set ( 'Content-Type' , 'application/json; charset=utf-8' )
0 commit comments