C
C#ā€¢11mo ago
Kratos

Help for Creating a Maui Application with Asp.net API and SQL Server Database Integration

I've been exploring the process of developing a Maui application integrated with its own API (Asp.net) and connected to a SQL Server database. I'm reaching out here in the hopes that someone might have come across documentation or resources explaining this integration in detail. During my search, I stumbled upon a video tutorial (https://www.youtube.com/watch?v=8J3nuUegtL4&t=140s) demonstrating the creation of an API encompassing login, registration, and other functionalities using Identity. I'm specifically interested in understanding how to access the tables automatically generated via migration in the SQL Server database and subsequently utilize them within a Maui application.(Reference: https://devblogs.microsoft.com/dotnet/whats-new-with-identity-in-dotnet-8/)
Patrick God
YouTube
.NET 8 Authentication with Identity in a Web API with Bearer Tokens...
šŸš€ Get 20% off the .NET Web Academy: https://www.dotnetwebacademy.com/bundles/net-web-academy?coupon=dnwa2024yt šŸ’– Support me on Patreon for exclusive source code access: https://patreon.com/_PatrickGod šŸš€ Get the .NET 8 Web Dev Jump-Start Course for FREE: https://dotnet8.patrickgod.com šŸ¦ Let's get social on Twitter/X: https://twitter.com/_Patrick...
Jeremy Likness
.NET Blog
What's new with identity in .NET 8 - .NET Blog
A summary of what's new with identity (authentication and authorization) in the latest ASP. NET Core release for .NET 8.
No description
No description
9 Replies
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
Kratos
KratosOPā€¢11mo ago
I've come to understand that direct database access from Maui isn't possible. However, within my project, I have a Maui app, an ASP.NET API, and a library containing classes/tables for the database. I came across a tutorial on Identity that showcased automatic table creation through migration. My challenge is accessing these tables from the API. Do you happen to know of any GitHub projects that demonstrate using Identity within an ASP.NET Core API?"
Kratos
KratosOPā€¢11mo ago
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
universalappco
universalappcoā€¢11mo ago
Have you started your project? If you're able to share your code I may have some time to help get you started. Are you using .NET Identity (Usernames stored in a database), or external identity providers such as Azure/Entra (Microsoft Identity Framework)?
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
universalappco
universalappcoā€¢11mo ago
In that case then it should be fairly easy. I haven't used the new token endpoints, but in .NET 8 there's built in endpoints for Token Based authentication, and it's only about 2 lines to add this on top of cookie-based auth that the web front-end uses. Before .NET 8 it was possible to mix the two already, but the new endpoints make it even easier (but come with some caveats that @Kratos should consider) @Kratos you already have .AddIdentityApiEndpoints() and .MapIdentityApi() in your program.cs so you're already setup to use these endpoints if they're suitable. From your MAUI app just use HttpClient to call the endpoints: This article will get you started https://andrewlock.net/exploring-the-dotnet-8-preview-introducing-the-identity-api-endpoints/
Andrew Lock | .NET Escapades
Introducing the Identity API endpoints: Exploring the .NET 8 previe...
In this post I introduce the new Identity APIs, show how they differ from the existing Identity support, and show how to use them.
Unknown User
Unknown Userā€¢11mo ago
Message Not Public
Sign In & Join Server To View
Kratos
KratosOPā€¢11mo ago
@universalappco @TeBeCo Thanks for the advice. We'll give it a try and let you know if it worked.
Want results from more Discord servers?
Add your server