This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string[] scopes = new string[] {AnalyticsService.Scope.Analytics}; // view and manage your Google Analytics data | |
var keyFilePath = @"c:\file.p12" ; // Downloaded from https://console.developers.google.com | |
var serviceAccountEmail = "xx@developer.gserviceaccount.com"; // found https://console.developers.google.com | |
//loading the Key file | |
var certificate = new X509Certificate2(keyFilePath, "notasecret", X509KeyStorageFlags.Exportable); | |
var credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(serviceAccountEmail) { | |
Scopes = scopes}.FromCertificate(certificate)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var service = new AnalyticsService(new BaseClientService.Initializer() { HttpClientInitializer = credential, | |
ApplicationName = "Analytics API Sample",}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AnalyticsService services = new AnalyticsService(new BaseClientService.Initializer() | |
{ | |
ApiKey = "[API key]", // from https://console.developers.google.com (Public API access) | |
ApplicationName = "Analytics API Sample", | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var services = new DriveService(new BaseClientService.Initializer(){ | |
ApiKey = "[API key]", // from https://console.developers.google.com (Public API access) | |
ApplicationName = "Drive API Sample", | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Authenticate to Google Using Oauth2 | |
/// Documentation https://developers.google.com/accounts/docs/OAuth2 | |
/// </summary> | |
/// <param name="clientId">From Google Developer console https://console.developers.google.com</param> | |
/// <param name="clientSecret">From Google Developer console https://console.developers.google.com</param> | |
/// <param name="userName">A string used to identify a user.</param> | |
/// <returns></returns> | |
public static WebmastersService AuthenticateOauth(string clientId, string clientSecret, string userName) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Wix | |
xmlns="http://schemas.microsoft.com/wix/2006/wi"> | |
<Product Id="*" Name="Daimto for SSIS (SQL Server 2008)" Language="1033" Version="1.0.0.0" | |
Manufacturer="DAIMTO" UpgradeCode="84543418-55c4-48c0-b5be-2496fb84ffb6"> | |
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" | |
InstallPrivileges="elevated" AdminImage="yes" /> | |
<MediaTemplate EmbedCab="yes" CompressionLevel="high" /> | |
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Creates the auth url | |
/// https://accounts.google.com/o/oauth2/auth?client_id={clientid}&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope={scope}&response_type=code | |
/// client id from google developer console. | |
/// scope comma seproated | |
/// </summary> | |
/// <returns></returns> | |
public static Uri GetAuthURI() | |
{ | |
return new Uri(string.Format("https://accounts.google.com/o/oauth2/auth?client_id={0}&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope={1}&response_type=code", Properties.Resources.clientId, Properties.Resources.scope)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void auth() | |
{ | |
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(GetTitle); | |
webBrowser1.Navigate(SimpleAuth.GetAuthURI().ToString()); | |
} | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AccessTokenResponse | |
{ | |
public string access_token { get; set; } | |
public string token_type { get; set; } | |
public string expires_in { get; set; } | |
} | |
/// <summary> | |
/// takes a refreshtoken and exchanges it for an accessotken. | |
/// </summary> |
OlderNewer