Example #1
0
        private void RefreshSession(SalesforceOAuthPlugin plugin)
        {
            PlatformAdapter.SendToCustomLogger("HybridMainPage.RefreshSession - Making a REST call to refresh session", LoggingLevel.Verbose);

            // Cheap REST call to refresh session
            _client.SendAsync(RestRequest.GetRequestForResources(ApiVersion), response =>
            {
                if (plugin != null)
                {
                    if (!response.Success)
                    {
                        PlatformAdapter.SendToCustomLogger(
                            string.Format("HybridMainPage.RefreshSession - Error = {0}", response.Error.ToString()), LoggingLevel.Verbose);

                        plugin.OnAuthenticateError(response.Error.Message);
                    }
                    else
                    {
                        PlatformAdapter.SendToCustomLogger("HybridMainPage.RefreshSession - refresh successful", LoggingLevel.Verbose);

                        plugin.OnAuthenticateSuccess(GetJSONCredentials());
                    }
                }
            });
        }
Example #2
0
 /// <summary>
 ///     Launch login flow if not authenticated or refresh auth token if already authenticated
 /// </summary>
 /// <param name="plugin"></param>
 public void Authenticate(SalesforceOAuthPlugin plugin)
 {
     _client = SDKManager.GlobalClientManager.GetRestClient();
     if (_client == null)
     {
         // login flow will get started, when page is eventually reloaded, we will be called again and _client will not be null
     }
     else
     {
         RefreshSession(plugin);
     }
 }
 private void RefreshSession(SalesforceOAuthPlugin plugin)
 {
     // Cheap REST call to refresh session
     _client.SendAsync(RestRequest.GetRequestForResources(API_VERSION), (response) =>
     {
         if (plugin != null)
         {
             if (!response.Success)
             {
                 plugin.OnAuthenticateError(response.Error.Message);
             }
             else
             {
                 plugin.OnAuthenticateSuccess(GetJSONCredentials());
             }
         }
     });
 }
        private void RefreshSession(SalesforceOAuthPlugin plugin)
        {
            PlatformAdapter.SendToCustomLogger("HybridMainPage.RefreshSession - Making a REST call to refresh session", LoggingLevel.Verbose);

            // Cheap REST call to refresh session
            _client.SendAsync(RestRequest.GetRequestForResources(ApiVersion), response =>
            {
                if (plugin != null)
                {
                    if (!response.Success)
                    {
                        PlatformAdapter.SendToCustomLogger(
                            string.Format("HybridMainPage.RefreshSession - Error = {0}", response.Error.ToString()), LoggingLevel.Verbose);

                        plugin.OnAuthenticateError(response.Error.Message);
                    }
                    else
                    {
                        PlatformAdapter.SendToCustomLogger("HybridMainPage.RefreshSession - refresh successful", LoggingLevel.Verbose);

                        plugin.OnAuthenticateSuccess(GetJSONCredentials());
                    }
                }
            });
        }
 /// <summary>
 ///     Launch login flow if not authenticated or refresh auth token if already authenticated
 /// </summary>
 /// <param name="plugin"></param>
 public void Authenticate(SalesforceOAuthPlugin plugin)
 {
     _client = SDKManager.GlobalClientManager.GetRestClient();
     if (_client == null)
     {
         // login flow will get started, when page is eventually reloaded, we will be called again and _client will not be null
     }
     else
     {
         RefreshSession(plugin);
     }
 }
 private void RefreshSession(SalesforceOAuthPlugin plugin)
 {
     // Cheap REST call to refresh session
     _client.SendAsync(RestRequest.GetRequestForResources(API_VERSION), (response) =>
     {
         if (plugin != null)
         {
             if (!response.Success)
             {
                 plugin.OnAuthenticateError(response.Error.Message);
             }
             else
             {
                 plugin.OnAuthenticateSuccess(GetJSONCredentials());
             }
         }
     });
 }