-
Notifications
You must be signed in to change notification settings - Fork 225
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
AddMicrosoftGraphAppOnly should add singleton service instead of scoped service #3242
Comments
If you choose to have token acquisition as a singleton, then Graph will also be a singleton builder.Services.AddAuthentication().
AddMicrosoftIdentityWebApi(builder.Configuration);
builder.Services.AddTokenAcquisition(true); // singleton
buildr.Services.AddMicrosoftGraphAppOnly();
var app = builder.Build();
var graphServiceClient = app.Services.GetRequiredService<GraphServiceClient>(); |
I meant this method microsoft-identity-web/src/Microsoft.Identity.Web.MicrosoftGraph/MicrosoftGraphExtensions.cs Lines 99 to 120 in ae4211e
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Microsoft.Identity.Web Library
Microsoft.Identity.Web
Microsoft.Identity.Web version
3.6.2
Web app
Not Applicable
Web API
Not Applicable
Token cache serialization
Not Applicable
Description
Unlike AddMicrosoftGraph, AddMicrosoftGraphAppOnly uses app permission instead of user permission.
So, GraphServiceClient should be added as singleton service in this context.
Reproduction steps
Error message
No response
Id Web logs
No response
Relevant code snippets
Regression
No response
Expected behavior
GraphServiceClient could be retrieved as singleton service.
The text was updated successfully, but these errors were encountered: