示例#1
0
        public async Task <MobileServiceUser> LoginAnonymouslyAsync(string impersonateUserId = null)
        {
            if (!IsInitialized)
            {
                await InitializeAsync();
            }

            if (string.IsNullOrEmpty(impersonateUserId))
            {
                var settings = await ReadSettingsAsync();

                impersonateUserId = settings?.UserId;                 // see if we have a saved user id from a previous token
            }

            var credentials = new JObject();

            if (!string.IsNullOrEmpty(impersonateUserId))
            {
                credentials["anonymousUserId"] = impersonateUserId;
            }
            MobileServiceUser user = await MobileService.LoginAsync("AnonymousUser", credentials);

            await CacheToken(user);

            return(user);
        }
        public async Task <MobileServiceUser> LoginAsync(string username, string password)
        {
            if (!IsInitialized)
            {
                await InitializeAsync();
            }

            var credentials = new JObject();

            credentials["email"]    = username;
            credentials["password"] = password;

            MobileServiceUser user = await MobileService.LoginAsync("Sandbox", credentials);

            return(user);
        }
示例#3
0
 protected override Task <MobileServiceUser> GetFacebookUserAsync()
 {
     return(MobileService.LoginAsync(Mvx.Resolve <IMvxAndroidCurrentTopActivity>().Activity, MobileServiceAuthenticationProvider.Facebook));
 }
 protected override async Task <MobileServiceUser> GetFacebookUserAsync()
 {
     return(await MobileService.LoginAsync(UIApplication.SharedApplication.KeyWindow.RootViewController, MobileServiceAuthenticationProvider.Facebook));
 }
示例#5
0
 protected override Task <MobileServiceUser> GetFacebookUserAsync()
 {
     return(MobileService.LoginAsync(MainActivity.Instance, MobileServiceAuthenticationProvider.Facebook));
 }