Skip to main content

Form-Based Authentication

  • 2 minutes to read

Task-based Scenarios - Authentication

This example uses our free .NET App Security & Web API Service to implement user authentication based on simple, form-based authentication logic (login/password).

View Example: Authentication

Related Controls: DXButton, TextEdit, PasswordEdit

Related APIs: FREE .NET App Security & Web API Service, PasswordEdit.StartIcon, TextEdit.StartIcon

Available Users:

  • Admin with an empty password.
  • Alex with the password 123.

Prerequisites

SQL Server, if you run this solution on Windows.

Anatomy

The scenario’s solution contains the following projects:

Web API Service

The .NET App Security & Web API Service Wizard generates a Web API Service that manages users, checks whether the requested user exists in the database, and what permissions he or she has.

Read Tutorial: Create a Standalone Web API Application

Watch Video: A 1-Click Solution for CRUD Web API with Role-based Access Control via EF Core & ASP.NET

The service contains the Authenticate endpoint that accepts a username and a password as parameters. If a user’s password matches its hashed entry in the database, the Web API Service sends an authorization token to the client. The .NET MAUI Application can use it to call other protected endpoints (request data).

.NET MAUI Application
Implements the UI (Login and Welcome pages) and logic to communicate with the Web API Service with the help of the HttpClient class.

The following diagram illustrates the scenario’s architecture:

Task-based Scenarios - Authentication Diagram

Implementation Details

Refer to the following GitHub example to see implementation details:

View Example: Authenticate Users with the DevExpress Web API Service

Next Step

Role-based Data Access

See Also

The following example uses our free Web API Service to implement auto-generated OData endpoints/custom endpoints, authentication, and access permissions: How to Create a Web API Service Backend for a .NET MAUI Application

The example also downloads files and integrate DevExpress Reports with our Web API Service.