Partager via


MicrosoftIdentityMessageHandlerOptions.Scopes Property

Definition

Gets or sets the scopes to request for the token.

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)

Property Value

A list of scopes required to access the target API. For instance, "user.read mail.read" for Microsoft Graph user permissions. For Microsoft Identity, in the case of application tokens (requested by the app on behalf of itself), there should be only one scope, and it should end with ".default" (e.g., "https://graph.microsoft.com/.default").

Examples

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

Remarks

This property must contain at least one scope, or the MicrosoftIdentityMessageHandler will throw a MicrosoftIdentityAuthenticationException when processing requests.

Applies to