Skip to content

[Feature Request] It should be possible to use GraphServiceClient to call graph APIs requiring app only permissions  #654

Closed
@jmprieur

Description

@jmprieur

Is your feature request related to a problem? Please describe.
When developers want to call graph to call an app only method, the current GraphServiceClient cannot be used as it uses GetTokenForUserAsync. See

await _tokenAcquisition.GetAccessTokenForUserAsync(_initialScopes).ConfigureAwait(false)));

number of customers hitting this issue so far: 2

Describe the solution you'd like
Have a way to call app only methods (corresponding to App-only scopes)

Describe alternatives you've considered

  • enable a second GraphServiceClient to be injected (with a different type ?). Maybe a class named AppOnlyGraphServiceClient which would have only one property which would be the GraphServiceClient, or which would inherit from GraphServiceClient.
  • have an extension method on GraphServiceClient which would specify that the developer wants to have an app-only and then use it GetTokenForUserAsync. See
    await _tokenAcquisition.GetAccessTokenForUserAsync(_initialScopes).ConfigureAwait(false)));

Additional context
See the ASP.NET Core Graph web hooks sample where the GraphServiceClient can only be used for delegated scopes:

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions