public async Task AuthenticateCustom(string username, string password) { try { LoginRequest lr = new LoginRequest(){ username = username, password = password }; CurrentUser = await client.InvokeApiAsync<LoginRequest,User> ("CustomLogin/Post/", lr); if (CurrentUser != null) { LocalData ld = new LocalData(); ld.InsertLocalUser(CurrentUser); if (string.IsNullOrEmpty(CurrentUser.Phone)) { IsTour = true; } } } catch (Exception ex) { Console.Error.WriteLine (@"ERROR - AUTHENTICATION FAILED {0}", ex.Message); } }
public async Task ReloadUser() { Dictionary<string,string> uid = new Dictionary<string,string>(); uid.Add("userid",CurrentUser.Id); CurrentUser = await client.InvokeApiAsync<User> ("UsersCustom/GetUser/", HttpMethod.Get, uid); LocalData ld = new LocalData(); ld.InsertLocalUser(CurrentUser); }
public async Task Authenticate(UIViewController view) { try { LocalData ld = new LocalData(); if (await PreAuthenticate()) { return; } // UIKit.UIViewController view = UIApplication.SharedApplication.KeyWindow.RootViewController; user = await client.LoginAsync(view, MobileServiceAuthenticationProvider.Facebook); //user = await client.LoginAsync(view,MobileServiceAuthenticationProvider.Facebook); Dictionary<string,string> uid = new Dictionary<string,string>(); uid.Add("userid",user.UserId); CurrentUser = await client.InvokeApiAsync<User> ("UsersCustom/UniversalUserId/", HttpMethod.Get, uid); ld.InsertLocalUser(CurrentUser); if (string.IsNullOrEmpty(CurrentUser.Phone)) { IsTour = true; } } catch (Exception ex) { Console.Error.WriteLine (@"ERROR - AUTHENTICATION FAILED {0}", ex.Message); } }