/// <summary> /// Shows the Google authentication web view so the user can authenticate /// </summary> async Task ShowGoogleAuthenticationView() { try { var api = new GoogleApi("google", Keys.GoogleApiClientId, Keys.GoogleClientSecret, new NativeMessageHandler()) { Scopes = Keys.GoogleScope.Split(' '), }; if(_doResetWebCache) { _doResetWebCache = false; api.ResetData(); } var account = await api.Authenticate(); if(account != null) { var oauthAccount = (OAuthAccount)account; App.AuthToken = "{0} {1}".Fmt(oauthAccount.TokenType, oauthAccount.Token); await Settings.Instance.Save(); } } catch(Exception e) { Console.WriteLine("**SPORT AUTHENTICATION ERROR**\n\n" + e.GetBaseException()); Insights.Report(e); } }
public override void AwakeFromNib() { base.AwakeFromNib(); var scopes = new[] { "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile" }; api = new GoogleApi("google", ClientId, ClientSecret) { Scopes = scopes, }; }