public override void OnReceivedError(WebView view, ClientError errorCode, string description, string failingUrl)
        {
            base.OnReceivedError(view, errorCode, description, failingUrl);
            var error = String.Format("Code:{0}, Description: {1}", errorCode, description);

            AuthenticationEventManager.OnAuthenticationResponseArrived(new AuthenticationResponseEventArgs {
                Success = false, ErrorMessage = error
            });
        }
        public void getTitleCallback(String jsResult)
        {
            Console.WriteLine(jsResult);
            var payload  = Encoding.UTF8.GetString(Convert.FromBase64String(jsResult.Replace("Success payload=", String.Empty)));
            var rawToken = JsonConvert.DeserializeObject <Dictionary <string, string> > (payload);

            AuthenticationEventManager.OnAuthenticationResponseArrived(new AuthenticationResponseEventArgs {
                Success   = true,
                TokenInfo = rawToken
            });
            PassiveAuthActivity.getInstance().Finish();
        }
        public override void OnPageFinished(WebView view, string url)
        {
            base.OnPageFinished(view, url);
            var payload = view.Title;

            if (payload.Contains("Success payload="))
            {
                view.LoadUrl(GET_TITLE_FN);
            }
            else if (payload.Contains("Error message="))
            {
                AuthenticationEventManager.OnAuthenticationResponseArrived(new AuthenticationResponseEventArgs {
                    Success      = false,
                    ErrorMessage = payload.Replace("Error message=", String.Empty)
                });
                //TODO: display alert with error
            }
        }