簡體   English   中英

在 Microsoft OIDC 授權中跳過離線訪問權限

[英]Skip offline access permission in Microsoft OIDC authorization

我正在使用此代碼

var app = ConfidentialClientApplicationBuilder.Create(AzureAdApplicationId)
   .WithTenantId("organizations")
   .WithRedirectUri(AzureAdRedirectUrl)
   .WithClientSecret(AzureAdSecretKey)
   .Build();

azureAdScopes = new List<string>() { "email" };

var signInRequest = app.GetAuthorizationRequestUrl(azureAdScopes);

var uri = await signInRequest.ExecuteAsync();

產生網址

https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?scope=email+openid+profile+offline_access&..

我只需要用戶的用戶名,我不需要離線訪問用戶的帳戶。 如何將它們從范圍中刪除?

您可以在不使用offline_access的情況下請求 url,但 Azure AD v2.0 OAuth2 帳戶同意頁面會自動列出“隨時訪問您的數據”,即使范圍中未指定 offline_access。 這是一個相關的問題

注釋文檔中顯示:

此時,對應用程序的初始同意中會自動包含 offline_access(“維護對您授予其訪問權限的數據的訪問權限”)和 user.read(“登錄並閱讀您的個人資料”)權限。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM