-1

I have 2 application one is 'dot net mvc' and 'dot net core web api'. Steps: if request done from mvc to api, api will again create a request to the mvc app with token it get in request as follow:

using (var client = new HttpClient() { BaseAddress = baseAddress })
var message = new HttpRequestMessage(HttpMethod.Get, "api/Auth");
....
}

So, if the MVC will authenticate that token and return the answer that the person has same token in cookie.

API is also checking the base address which contains the MVC app URL, so no other app can do the request to API and if any do then it will unauthenticated it.

It is working in local and production server, but not in the staging.

Can anyone suggest me something

I have checked the base URL it is correct. it is sending the request to "api/Auth" to MVC correctly.

  • Hi @Haresh Savlani, could you pls share more code? How does your application configure service/middleware? – Rena Sep 23 '22 at 08:10
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – MB_18 Oct 02 '22 at 12:03

1 Answers1

0

Your question is not clear to me. Maybe, you should add the access token to httpClient RequestHeaders.

httpClient.DefaultRequestHeaders.Add("Authorization", accessToken);
MB_18
  • 1,620
  • 23
  • 37