user1044169
user1044169

Reputation: 2866

MSAL AcquireTokenByAuthorizationCode in a web farm

I am using ASP.NET 4.8, implementing OpenID auth against Azure AD, and consecutive provisioning of access to Power BI APIs. The scenario is described here. What I don't understand is how this works in a web farm.

Here is how I understand the steps on a single server:

I guess I don't understand how this works in a multi-server scenario. If node A in a web farm went through the steps above and contains the access and refresh tokens, what happens when a request is served by node B that has none of these tokens? Is there a way to get a hold of the refresh token from a cookie in order to request a new access token on node B?

Thank you for your help!

Upvotes: 0

Views: 818

Answers (1)

FreemanRU
FreemanRU

Reputation: 349

You should use the distributed cache. More about this here: https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-net-token-cache-serialization?tabs=aspnetcore#distributed-token-caches

Note: link above contains not a ready-to-use example, you will need to setup any kind of real distributed cache first (SQL, Radis, NCache): https://learn.microsoft.com/en-us/aspnet/core/performance/caching/distributed

Upvotes: 1

Related Questions