public static async Task <AuthenticationResult> Authenticate(string username, string password) { var request = new UsernamePasswordLoginRequest { ClientId = ClientId, Connection = "Username-Password-Authentication", Scope = "openid profile", Username = username, Password = password }; try { await ApiClient.UsernamePasswordLoginAsync(request); // No error: return(new AuthenticationResult() { Success = true }); } catch (ApiException exception) { return(new AuthenticationResult() { Message = exception.Message }); } }
public async Task <UsernamePasswordLoginResponse> UsernamePasswordLogin(UsernamePasswordLoginRequest request) { if (request != null && string.IsNullOrEmpty(request.Tenant) && baseUri.Host.Contains(".")) { request.Tenant = baseUri.Host.Split('.')[0]; } if (request != null && string.IsNullOrEmpty(request.ResponseType)) { request.ResponseType = "code"; } return(new UsernamePasswordLoginResponse() { HtmlForm = await Connection.PostAsync <string>("usernamepassword/login", request, null, null, null, null, null).ConfigureAwait(false) }); }