My app is integrated with ASP.NET MVC and works with a cookie-based authentication.
At first, I run a config method to get the basic user ID & culture that needs to pass in subsequent calls, using APP_INITIALIZER
, this resolved in 72 ms:
This sets a cookie in the browser via
Response header:
Set-Cookie: access-cookie=iT0VQOmOIn-NcJNGoJ3Qc32iLUnxsyIe3GLexNmtqq6sIiGSEHCCs8unI-m_F_hZsVmwtlLRPx-5zxomc5tusNXDC5I1; expires=Thu, 28 May 2020 21:42:21 GMT; path=/
This token is further used by next API call (automatically) like:
Request Header:
access-token: iT0VQOmOIn-NcJNGoJ3Qc32iLUnxsyIe3GLexNmtqq6sIiGSEHCCs8unI-m_F_hZsVmwtlLRPx-5zxomc5tusNXDC5I1
As you can see call took really long time to resolve.
Now if I copy the same access-token
to the parameters in Postman and run it from my local machine, it's resolved in 732ms
I have no idea why it is like this.
My Angular code:
ngOnInit(): void {
this.getData().subscribe({
next: e => console.log(e)
});
}
getData() {
return this.http.post('./api/Portfolio/GetUiData', this.configService.getHeaderParams());
}