-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] CallsMicrosoftGraph in Startup.cs enables usage of the Graph SDK in controllers / Razor / Blazor pages #427
Comments
jmprieur
changed the title
[Feature Request] CallsMicrosoftGraph exposes the Graph SDK
[Feature Request] CallsMicrosoftGraph in Startup.cs enables usage of the Graph SDK in controllers / Razor / Blazor pages
Aug 10, 2020
jmprieur
added a commit
that referenced
this issue
Aug 13, 2020
Fixes #427 Add the `MicrosoftGraphOptions`, `MicrosoftGraphServiceExtensions`, `TokenAcquisitionCredentialProvider` (coming from the Blazor sample) Update the test apps that where using graph - WebAppCallsMicrosoftGraph - BlazorServerCallsGraph Updating the samples requires the following: - remove the package reference to the Microsoft Graph SDK, as it is no longer needed in the sample (brought by Microsoft.Identity.Web) - update the appsettings.Json to use the new names for the settings (`BaseUrl` and `Scopes`) - remove the implementation which was so far in the sample for the MicrosoftGraphService and it's token provider (this was the implementation brought by the project templates) - in startup.cs, remove the calls to `services.AddMicrosoftGraph(scopes, Configuration.GetValue<string>("CalledApi:CalledApiUrl"));` and replace it by what we agreed on with Damien: ```CSharp .EnableTokenAcquisitionToCallDownstreamApi() .AddMicrosoftGraphServiceClient(Configuration.GetSection("GraphBeta")) ``` Co-authored-by: pmaytak <34331512+pmaytak@users.noreply.github.com> Co-authored-by: Jenny Ferries <jeferrie@microsoft.com>
Included in 0.3.0-preview release. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue
Today the template introduce files to easy calling MIcrosoft Graph that would benefit from being productized in the library
Spec
See #431
We'd want to be able to set which Microsoft graph endpoint to use (v1.0, Beta, but also national clouds) from the configuration, or programmatically. For instance in the appsettings.json
And be able to reference them in a
CallsMicrosoftGraph
method that would be called underCallsWebApi()
or underAddMicrosoftIdentityWebApp
orAddMicrosoftIdentityWebApi
(to be decided)We'll also provide a simple override that use the default (https://graph.microsoft.com/v1.0 and "user.read")
And an override that offers a delegate:
In the controller or a Razor page, or a Blazor page, the GraphServiceClient will be injected by dependency injection and simply used.
Proposed design / work to be done
TokenAcquisitionCredentialProvider
class which is currently shipped in the templates.Microsoft.Graph
NuGet package from the Microsoft.Identity.Web projectMicrosoft.Graph
NuGet package from all the test apps that use itMicrosoftGraphServiceExtensions
inspired by the one shipped in the templates, but applied toThe override with delegates will need to add the following services:
builder.Services.AddOptions<CalledApiOptions>().Configure(configureOptions)
)builder.Services.AddTokenAcquisition(true)
)Update the test apps to use this new way of adding Graph (in the Startup.cs / appsettings.json)
Update the project templates to use this new way of adding Graph (and remove the references to the Microsoft.Graph NuGet package)
The text was updated successfully, but these errors were encountered: