public async Task GetTokensAsync(GetTokensRequest request) { await EnsureInGroupAsync(request, false); var response = await _service.GetTokensAsync(request); SendGroupResponse(response); var getUserInfoRequest = new GetUserInfoRequest { AccessToken = response.AccessToken }.LinkTo(response); await GetUserInfoAsync(getUserInfoRequest); }
public async Task <ActionResult> Login() { var formData = Request.Form; if (formData == null || !formData.HasKeys()) { return(RedirectToAction(nameof(Index))); } var request = new GetTokensRequest { Username = formData["username"], Password = formData["password"] }; var response = await _oauthClientService.GetTokensAsync(request); if (!response.IsError && !string.IsNullOrWhiteSpace(response.AccessToken) && !string.IsNullOrWhiteSpace(response.RefreshToken)) { return(RedirectToAction(nameof(Home))); } return(RedirectToAction(nameof(Index))); }
public async Task <HttpResponseMessage> GetTokensAsync(GetTokensRequest request) { var response = await _service.GetTokensAsync(request); return(Request.CreateResponse(response)); }