/// <summary> /// Saves access token in device /// </summary> /// <param name="token"></param> /// <param name="clientId">Client Id is used as resource string for PasswordCredential</param> /// <returns></returns> private async Task <bool> SaveToken(string token, string clientId) { try { GlobalHelper.GithubClient = UserUtility.GetAuthenticatedClient(token); User user = await UserUtility.GetCurrentUserInfo(); var vault = new PasswordVault(); vault.Add(new PasswordCredential(clientId, user.Id.ToString(), token)); await AccountsService.AddUser(new Models.Account { Id = user.Id, AvatarUrl = user.AvatarUrl, IsLoggedIn = true, Login = user.Login, IsActive = true }); return(true); } catch { return(false); } }