TechieHints SOFTWARE

[Solved]: Cookie is not able to Set / Access with Anguar Http Calls

In angular, Cookie access will not be able to given directly hence it fails to write info.

Solution is using HTTPInterceptors in Angular Code, we should be able to achieve this.

Create service and Implement HttpInterceptor  as below

InterceptorsService implements HttpInterceptor
 …..

Give definition for intercept method.

intercept(request: HttpRequest, next: HttpHandler): Observable<HttpEvent> 

    request=request.clone(

      withCredentials:true

    );

    returnnext.handle(request);

 

Leave a comment