© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
13 replies
Alex

✅ How to get Options from DI

I configured options for google authentication
CliendId
CliendId
and
ClientSecret
ClientSecret
.

builder.Services.ConfigureOptions<GoogleOptions>();
builder.Services.ConfigureOptions<GoogleOptions>();


Here I want to get them from
ServiceProvider
ServiceProvider
but I don't know how. Should I create
ServiceProvider
ServiceProvider
 var provider = builder.Services.BuildServiceProvider();
 var provider = builder.Services.BuildServiceProvider();
?

builder.Services.AddAuthentication()
    .AddGoogle((options) =>
    {
        options.ClientId = "";
        options.ClientSecret = "";
    });
builder.Services.AddAuthentication()
    .AddGoogle((options) =>
    {
        options.ClientId = "";
        options.ClientSecret = "";
    });
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ How to Get DI Services in a Console Application
C#CC# / help
10mo ago
❔ How DI works?
C#CC# / help
4y ago
Get information about DI container:
C#CC# / help
13mo ago
❔ ✅ How to get ImageLocation from Controls?
C#CC# / help
3y ago