最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

windows - Can OperatingSystemAccount Get User Account - Stack Overflow

programmeradmin4浏览0评论

When I am learning the MSAL library, I met some code that use PublicClientApplication.OperatingSystemAccount to get an access token, as shown in this code here:

var publicAppBuilder = PublicClientApplicationBuilder
      .Create(appClientId)
      .WithParentActivityOrWindow(consoleWindowHandleProvider)
      .WithAuthority(authorityUri)
      .WithBrokerPreview(true)
      .WithDefaultRedirectUri()
      .Build();

var result = publicAppBuilder.AcquireTokenSilent(scope, 
   PublicClientApplication.OperatingSystemAccount)
                             .ExecuteAsync().GetAwaiter().GetResult();

The PublicClientApplication documentation also mentioned OperatingSystemAccount as:

A special account value that indicates that the current operating system account should be used to log the user in.

I think the MSAL library code can get the user account from OperatingSystemAccount, and then use that user account to get the access token of the user from Azure AD, is my reasoning correct?

发布评论

评论列表(0)

  1. 暂无评论