Skip to content

Instantly share code, notes, and snippets.

@LindaLawton
Created August 12, 2015 13:00
Show Gist options
  • Save LindaLawton/a67fcdf3d9a2a7e25c5b to your computer and use it in GitHub Desktop.
Save LindaLawton/a67fcdf3d9a2a7e25c5b to your computer and use it in GitHub Desktop.
Google oauth2 email.
string _client_id = "[From Google Developer Console]";
string _client_secret = "[From Google Developer Console]";
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = _client_id, ClientSecret = _client_secret },
new string[] {"email" },
Environment.UserName ,
CancellationToken.None,
new FileDataStore("Daimto.GooglePlus.Auth.Store")).Result;
// Now we create a Google service. All of our requests will be run though this.
var plusService = new PlusService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Google Plus Sample",
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment