public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init ();

            // Code for starting up the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            LoadApplication (new App ());

            //logout
            var accountService =new AccountHelper(new SecureStorage());
            accountService.ClearCredentials ();

            return base.FinishedLaunching (app, options);
        }
        public async System.Threading.Tasks.Task Login()
        {
            //show login
            var user = await LoginAsync(Forms.Context, withRefreshToken: true, title: "Sign In");

            //after login, create user object.
            User toReturn = new User()
            {
                IdToken = user.IdToken,
                RefreshToken = user.RefreshToken,
                Email = user.Profile["email"].Value<string>()
            };

            //create account service and store the credentials on the device.
            var accountService = new AccountHelper(new KeyVaultStorage());
            accountService.StoreCredentials(toReturn);
            SetUser(toReturn);
        }
	    public async System.Threading.Tasks.Task Login (){
            //get the main controller
			var controller = UIApplication.SharedApplication.KeyWindow.RootViewController;

            //show login page.
            var result = await LoginAsync(
                controller,
                withRefreshToken: true);

            //after login, create user object.
	        User toReturn = new User()
	        {
                IdToken = result.IdToken,
                RefreshToken = result.RefreshToken,
                Email = result.Profile["email"].Value<string>()
	        };

            //create account service and store the credentials on the device.
            var accountService =new AccountHelper(new SecureStorage());
            accountService.StoreCredentials(toReturn);

            //set the current user.
            SetUser(toReturn);
        }