Google OAuth 2.0 .NET

536 views Asked by At

I am not really experienced in .NET or C# however I am trying to extend a .NET web application by integrating Google Authentication in order to work with Google Calendar. First I made a sample console project where everything works fine and afterwards I tried to use the same authenticating approach for the web application following this template:

credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                secrets,
                Scopes,
                "user",
                CancellationToken.None,
                credentialPersistanceStore).Result;

I understand that it is probably not possible to use this approach for web applications (even though I wonder why) GoogleWebAuthorizationBroker.AuthorizeAsync Hangs Nevertherless I found that Google .NET API Client library suggests to use Google.Apis.Auth.OAuth2.Mvc for web applications. The problem is that my application is NOT a MVC application. And that's why I would like to know if there is some more universal way how to deal with Google Authentication in .NET web applications (without manually constructing every single HTTP request) with the possibility to store credentials in e.g. IDataStore than a FileDataStore.

Thank you in advance.

0

There are 0 answers