Example #1
0
        public async Task Login(MobileServiceAuthenticationProvider provider)
        {
            var user = await _loginProvider.LoginAsync(MobileServiceClient, provider);

            CurrentUser = user;
            var cache = new LoginToken(user, provider);
            await cache.Persist();
        }
Example #2
0
 private void Authenticate(object sender, EventArgs e)
 {
     _loginProvider.LoginAsync().ContinueWith(async(authInfo) =>
     {
         if (!string.IsNullOrWhiteSpace(authInfo.Result.IdToken))
         {
             MainThread.BeginInvokeOnMainThread(() =>
             {
                 App.Current.MainPage.DisplayAlert("Auth", $"IdToken is : {authInfo.Result.IdToken}", "Cancel");
             });
         }
     });
 }
Example #3
0
        private async Task ExecuteLogin()
        {
            var authInfo = await _loginProvider.LoginAsync();

            if (string.IsNullOrWhiteSpace(authInfo.AccessToken) || !authInfo.IsAuthorized)
            {
                await _messageService.Show(Global.Error, Global.AppCannotAuthenticate);
            }
            else
            {
                await _tokenStorage.Store(authInfo);

                Device.BeginInvokeOnMainThread(async() =>
                {
                    await Shell.Current.GoToAsync("//notifications");
                });
            }
        }
Example #4
0
 public async Task LoginAsync()
 {
     await loginProvider.LoginAsync(MobileService);
 }