public override void Initialize() { // ************************************* // AUTHENTICATION to Remember The Milk // ************************************* var authToken = Application.Instance.Preferences.Get (Tasque.Preferences.AuthTokenKey); if (authToken != null) { Debug.WriteLine ("Found AuthToken, checking credentials..."); try { rtm = new Rtm (ApiKey, SharedSecret, authToken); rtmAuth = rtm.AuthCheckToken (authToken); timeline = rtm.TimelineCreate (); Debug.WriteLine ("RTM Auth Token is valid!"); Debug.WriteLine ("Setting configured status to true"); Configured = true; } catch (RtmApiException e) { Application.Instance.Preferences.Set (Tasque.Preferences.AuthTokenKey, null); Application.Instance.Preferences.Set (Tasque.Preferences.UserIdKey, null); Application.Instance.Preferences.Set (Tasque.Preferences.UserNameKey, null); rtm = null; rtmAuth = null; Trace.TraceError ("Exception authenticating, reverting" + e.Message); } catch (RtmWebException e) { rtm = null; rtmAuth = null; Trace.TraceError ("Not connected to RTM, maybe proxy: #{0}", e.Message); } catch (WebException e) { rtm = null; rtmAuth = null; Trace.TraceError ("Problem connecting to internet: #{0}", e.Message); } } if (rtm == null) rtm = new Rtm (ApiKey, SharedSecret); StartThread (); }
public void Initialize() { // ************************************* // AUTHENTICATION to Remember The Milk // ************************************* string authToken = Application.Preferences.Get (Preferences.AuthTokenKey); if (authToken != null ) { Logger.Debug("Found AuthToken, checking credentials..."); try { rtm = new Rtm(apiKey, sharedSecret, authToken); rtmAuth = rtm.AuthCheckToken(authToken); timeline = rtm.TimelineCreate(); Logger.Debug("RTM Auth Token is valid!"); Logger.Debug("Setting configured status to true"); configured = true; } catch (RtmNet.RtmApiException e) { Application.Preferences.Set (Preferences.AuthTokenKey, null); Application.Preferences.Set (Preferences.UserIdKey, null); Application.Preferences.Set (Preferences.UserNameKey, null); rtm = null; rtmAuth = null; Logger.Error("Exception authenticating, reverting" + e.Message); } catch (RtmNet.RtmWebException e) { rtm = null; rtmAuth = null; Logger.Error("Not connected to RTM, maybe proxy: #{0}", e.Message); } catch (System.Net.WebException e) { rtm = null; rtmAuth = null; Logger.Error("Problem connecting to internet: #{0}", e.Message); } } if(rtm == null) rtm = new Rtm(apiKey, sharedSecret); StartThread(); }
public void FinishedAuth() { rtmAuth = rtm.AuthGetToken (frob); if (rtmAuth != null) { var prefs = Application.Instance.Preferences; prefs.Set (Tasque.Preferences.AuthTokenKey, rtmAuth.Token); if (rtmAuth.User != null) { prefs.Set (Tasque.Preferences.UserNameKey, rtmAuth.User.Username); prefs.Set (Tasque.Preferences.UserIdKey, rtmAuth.User.UserId); } } var authToken = Application.Instance.Preferences.Get (Tasque.Preferences.AuthTokenKey); if (authToken != null) { Debug.WriteLine ("Found AuthToken, checking credentials..."); try { rtm = new Rtm (ApiKey, SharedSecret, authToken); rtmAuth = rtm.AuthCheckToken (authToken); timeline = rtm.TimelineCreate (); Debug.WriteLine ("RTM Auth Token is valid!"); Debug.WriteLine ("Setting configured status to true"); Configured = true; Refresh (); } catch (Exception e) { rtm = null; rtmAuth = null; Trace.TraceError ("Exception authenticating, reverting" + e.Message); } } }
public void FinishedAuth() { rtmAuth = rtm.AuthGetToken(frob); if (rtmAuth != null) { Preferences prefs = Application.Preferences; prefs.Set (Preferences.AuthTokenKey, rtmAuth.Token); if (rtmAuth.User != null) { prefs.Set (Preferences.UserNameKey, rtmAuth.User.Username); prefs.Set (Preferences.UserIdKey, rtmAuth.User.UserId); } } string authToken = Application.Preferences.Get (Preferences.AuthTokenKey); if (authToken != null ) { Logger.Debug("Found AuthToken, checking credentials..."); try { rtm = new Rtm(apiKey, sharedSecret, authToken); rtmAuth = rtm.AuthCheckToken(authToken); timeline = rtm.TimelineCreate(); Logger.Debug("RTM Auth Token is valid!"); Logger.Debug("Setting configured status to true"); configured = true; Refresh(); } catch (Exception e) { rtm = null; rtmAuth = null; Logger.Error("Exception authenticating, reverting" + e.Message); } } }