I am trying to avoid the nested subscription in request to the backend. I need to login, then get a service token based on the response of the login, then get a encryption token based on the service token.
I have seen about concatMap but i am not sure how to use the first response in the second request or third
this.rest.CallLogin(this.data).pipe(
concatMap(serviceToken => this.rest.GetServiceTicket(1stresponse.headers.get('Location'))),// dont know how to get the 1st response from CallLogin
concatMap(tokenResponse => this.rest.getEncryptToken(serviceToken)),
);