Language

MicrosoftIdentityMessageHandlerOptions.Scopes プロパティ

定義

トークンを要求するスコープを取得または設定します。

public System.Collections.Generic.IList<string> Scopes { get; set; }
member this.Scopes : System.Collections.Generic.IList<string> with get, set
Public Property Scopes As IList(Of String)

プロパティ値

ターゲット API にアクセスするために必要なスコープの一覧。 たとえば、ユーザーのアクセス許可の "user.read mail.read" Microsoft Graph。 Microsoft ID の場合、アプリケーション トークンの場合 (それ自体に代わってアプリによって要求されます)、スコープは 1 つだけで、"default" で終わる必要があります (例: "https://graph.microsoft.com/.default")。

例

var options = new MicrosoftIdentityMessageHandlerOptions();
options.Scopes.Add("https://graph.microsoft.com/.default");
options.Scopes.Add("https://myapi.domain.com/access");

注釈

このプロパティには、少なくとも 1 つのスコープを含める必要があります。または、要求の処理時に MicrosoftIdentityMessageHandler が MicrosoftIdentityAuthenticationException をスローします。

適用対象