ThomasWeiss
ThomasWeiss

Reputation: 1302

Authenticating a user without querying a particular Google service

I would like to use the .NET client API to authenticate a user & authorize a web server application - using the Google.Apis.* packages from NuGet.

I had a look at the samples and have understood how the NativeApplicationClient and WebServerClient are used there. I had particular look at the "Tasks.ASP.NET.SimpleOAuth2" sample. But what I'm trying to achieve is to perform the authentication without any call to the Google service I want to ultimately use, whereas in the samples, the authentication is initially setup and "automatically" called upon the first request to the service.

Let's say my app would like to use Calendar. So I would like to use the SDK to:

but without any actual call to the Calendar service at this step.

Any guidance would be greatly appreciated here. Thanks

Upvotes: 0

Views: 249

Answers (1)

peleyal
peleyal

Reputation: 3512

We are working hard on improving the OAuth2 flows. In only several weeks we are going to introduce a new (and definitely a better) way to authenticate. Meantime you can use the code in our repository (it's an open source project). Take a look at https://code.google.com/p/google-api-dotnet-client/source/browse/Src/GoogleApis.Auth/OAuth2/AuthorizationCodeFlow.cs and also https://code.google.com/p/google-api-dotnet-client/source/browse/Src/GoogleApis.Auth/OAuth2/GoogleAuthorizationCodeFlow.cs.

Release 1.6.0-beta will include those flows and will introduce UserCredential and ServiceAccountCredential. We are going to support WP, WinRT and MVC4 applications as well

Upvotes: 2

Related Questions