refactoring

This commit is contained in:
Paul Schneider 2017-06-14 12:28:08 +02:00
commit fa85a5a1a6
46 changed files with 3130 additions and 553 deletions

View file

@ -101,6 +101,25 @@ public static class GoogleHelper
return null;
}
#if GoogleApisAuthOAuth2
public static ServiceAccountCredential GetGoogleApiCredentials (string[] scopes)
{
String serviceAccountEmail = "SERVICE_ACCOUNT_EMAIL_HERE";
string private_key = Startup.GoogleSettings.Account.private_key;
string secret = Startup.GoogleSettings.ClientSecret;
var certificate = new X509Certificate2(@"key.p12", secret, X509KeyStorageFlags.Exportable);
return new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = scopes
}.FromCertificate(certificate));
}
#endif
// Get the given subProperty from a list property.
private static string TryGetFirstValue(JObject user, string propertyName, string subProperty)
{