Form-Based Authentication
- 2 minutes to read
This example uses our free .NET App Security & Web API Service to implement user authentication based on simple, form-based authentication logic (login/password).
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.
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:
Implementation Details
Refer to the following GitHub example to see implementation details:
Next Step
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.