protected static async Task AuthenticateUser(GitHubUserService gitHubUserService, GitHubGraphQLApiService gitHubGraphQLApiService) { var token = await Mobile.Common.AzureFunctionsApiService.GetTestToken().ConfigureAwait(false); if (token.IsEmpty() || string.IsNullOrWhiteSpace(token.AccessToken)) { throw new Exception("Invalid Token"); } await gitHubUserService.SaveGitHubToken(token).ConfigureAwait(false); var(login, name, avatarUri) = await gitHubGraphQLApiService.GetCurrentUserInfo(CancellationToken.None).ConfigureAwait(false); gitHubUserService.Alias = login; gitHubUserService.Name = name; gitHubUserService.AvatarUrl = avatarUri.ToString(); }
public HomeController() { gitHubRepositoryService = new GitHubRepositoryService(); gitHubUserService = new GitHubUserService(); }