1,309 questions
1
vote
1
answer
92
views
ASP.NET Core 8 Identity doesn't confirm email
I'm trying to confirm an email with the generated email confirmation token of UserManager, I literally have a working project with this same code, but I don't understand why this is happening now.
...
1
vote
0
answers
49
views
ASP.NET Core 9 Identity - sign out not working
I've created a minimal poc for logging in and out using UserManager and SignInManager to create a registration, login, logout, and check if you're logged in:
[HttpPost("logout")]
[Authorize]
...
1
vote
0
answers
112
views
Where is /login handled in ASP.Net Core Web API?
I have an ASP.NET Core Web API. When I set it up, I used the built-in ASP.NET Core identity stuff because that was fast and got me directly into writing the meat of the API functionality. Now I need ...
2
votes
1
answer
87
views
Custom login from external database with ASP .NET Core identity
I am using ASP.NET Core Identity to secure a REST API. I am calling AddIdentityCore, provide my own user with some additional properties and use the default SignInManager.CheckPasswordSignInAsync to ...
1
vote
0
answers
69
views
How can I use the lockout feature in ASP.NET with the pre-compiled Identity package?
I was trying to figure out why in my application, my IdentityUser lockout does not work. It is a brand new project!
builder.Services.Configure<IdentityOptions>(options =>
{
options....
1
vote
0
answers
124
views
.NET 8.0 always returns 403
I am developing a website on .NET 8.0. There is no problem in my Visual Studio IIS (I mean, my local development environment), but when I publish my website (to publish my website, I follow this path :...
0
votes
0
answers
34
views
Add image to identity profile in Blazor on .NET 8
I am using Microsoft Visual Studio Community 2022 (64-bit) v17.14.16. I have followed your code but I am getting error in OnValidSubmitAsync when the function
private async Task OnValidSubmitAsync()
...
1
vote
1
answer
47
views
ASP.NET Core: using MapWhen with UseOpenIdConnectAuthentication
I'm trying to have a dynamic OpenId configuration based on the host of the request.
More specifically: I have 2 DNS setup for a given website; one starting with "TV" and I'm trying to call ...
0
votes
1
answer
48
views
ASP.NET Core Web API not authenticating with Identity cookies from Blazor Server app
I have two ASP.NET Core applications:
Blazor Server app with Identity authentication (working correctly)
Web API that should share authentication cookies with the Blazor app
The API is not ...
0
votes
0
answers
67
views
ASP.NET Core MVC Identity is not confirming email account addresses on registration
I have an ASP.NET Core MVC website that uses individual accounts with the Microsoft Identity provider. I used the Visual Studio scaffold option to add the Identity user accounts to my project, but I ...
0
votes
0
answers
20
views
Blazor server side with MS Identity (AspNetUsers) - issues with using roles
I have started a new Blazor server app via this call
dotnet new blazor --name RateWeb -au Individual --force
I can login and out and the auth mechanism works as long as I do not use
@attribute [...
1
vote
1
answer
117
views
Blazor Server + Identity: SignInManager.SignInAsync doesn't persist login (cookie not set)
I'm building a Blazor Server app (.NET 9, Identity + Entity Framework Core + MudBlazor). I have a custom login form and I want to authenticate the user manually using SignInManager.
I'm using this ...
0
votes
1
answer
85
views
Accessing ASP.NET Core 9 Web API user in service layer
I'm building an ASP.NET Core 9 Web API with Identity and EF Core. One of the POST endpoints adds a row to a database table, which also contains user.
In theory, I could extract the user using ...
2
votes
1
answer
399
views
Why use both Authorize attribute and AuthorizeView in a Blazor page?
I'm just getting started with Blazor, and while going through the scaffolded project that uses Identity with both SSR and WASM, I noticed that the Auth.razor page in the client project includes both ...
0
votes
1
answer
73
views
Can't use of custom user data added to identity user
Based on Microsoft learn, I try to add custom user data to an identity user, but where ever I try to use WebApp1User I get this error:
InvalidOperationException: No service for type 'Microsoft....
0
votes
0
answers
182
views
ASP.NET Core 8.0 Microsoft authentication error - AuthenticationFailureException: the oauth state was missing or invalid
My setup:
ASP.NET Core 8 MVC application, configured to act purely as an API (returns JSON, no traditional views)
Frontend: React application running on http://localhost:3000
Backend API: running on ...
2
votes
0
answers
96
views
Where is the secret key of AddBearerToken in Identity
I am using Identity in my ASP.NET Core Web API.
Here is the code for authentication and authorization:
public static void AddAuthorizationWithIdentity(this WebApplicationBuilder builder)
{
builder....
1
vote
1
answer
51
views
Configuring integration tests for ASP.NET Core Identity external providers. Challenge() returns 401
My goal is to configure integration tests for external login providers in my app. I want to mock an external login provider and simulate its behavior. So for example in my test I want to call /api/...
0
votes
0
answers
57
views
How to use Identity API endpoints in an ASP.NET Core web project without custom middleware?
I'm developing a .NET Core Identity API using the following setup:
builder.Services.AddIdentityApiEndpoints<AppUser>()
.AddRoles<AppRole>()
....
1
vote
0
answers
99
views
Running "dotnet build" a second time always fails
I have an ASP.NET Core web project. If I open a "CMD" console, change to the directory where my project and run dotnet build, it successfully builds the first time I run it.
If I run dotnet ...
0
votes
1
answer
122
views
ASP.NET Core Identity cookie Issue
My issue is pretty weird. Normally, I encounter this problem in my main application, but to simulate it, I created a smaller app — and I'll be sharing all examples from there because I'm facing the ...
0
votes
0
answers
25
views
Why does SignInWithClaimsAsync return a token during login but not when switching tenant in ASP.NET Core Identity?
I'm using ASP.NET Core Identity with AddIdentityApiEndpoints<User>() and bearer token authentication configured via BearerTokenOptions.
In my login use case, I use the following:
await ...
1
vote
0
answers
124
views
Identity Pages give 503 when navigating to them. They have different path base URI than the Blazor Pages
I am building an ASP.NET Core 8 web application with Blazor pages. The URI I have been assigned for my web application on the production server is not hosted at the root / of the server but at the ...
0
votes
1
answer
90
views
Microsoft Identity Blazor .NET 8 Server (failed login)
I have a Blazor .NET 8 server application, with render mode per component. For authentication I use ASP.NET Core Identity. When starting the application, I create an admin, if it does not already ...
0
votes
0
answers
30
views
AddJwtBearer OnAuthenticationFailed - skip validation for unprotected routes
In my controller, I have both protected and unprotected routes.
For the unprotected routes, I want the JWT pipeline to skip validation on those endpoints. This is how I handled it. However I'm not 100%...
0
votes
0
answers
54
views
ASP.NET Core Web API and email verification troubles
Let me give you some context: I know it's a fairly specific question which probably can be answered by googling. Which I've done and followed some guide but I feel like there is something I am doing ...
1
vote
2
answers
156
views
C# .NET Core Identity with Mongo DB GUID Representation Mode issue
I am trying to use .NET's Core Identity, but via MongoDB instead SQL Server. I found a NuGet package that seems to fit the bill, but when I attempt to use it I get the following error:
System....
0
votes
0
answers
57
views
ASP.NET Core Identity for Web APIs - customize the confirmEmail page
I'm using ASP.NET Core Identity to secure a Web API per this documentation. I'm setting RequireConfirmEmail to true, meaning that when the user registers, he will get an email for confirmation ...
1
vote
1
answer
100
views
API is not working with [Authorize] but works fine with [AllowAnonymous] in ASP.NET Core 3.1
I am working on an API with ASP.NET Core 3.1 and I have created multiple controllers. This API uses a JWT bearer token to authenticate the caller where LoginController has three endpoints Login, Error ...
0
votes
1
answer
37
views
ASP.NET Core Web API authorization
I am working through a book on ASP.NET Core Web API and I am trying to implement authorization.
Here is my Program.cs:
var builder = WebApplication.CreateBuilder(args);
var connString = builder....
0
votes
1
answer
89
views
Scaffolding Identity does not create Required Pages for Login and Register
I am trying to Scaffold Identity UI containing Login.cshtml and Register.cshtml for my ASP.NET Core application.
The code in my Program.cs file is:
using ObjectCrudApp.Data;
using Microsoft....
0
votes
1
answer
57
views
ASP.NET Core Identity collapse
Building an intranet system in ASP.NET Core and all was working fine but now I have added identity to it so that a login system can be integrated I have hit a complete roadblock.
Added an identity ...
0
votes
1
answer
71
views
Set custom folder when scaffolding .NET Core Identity
I scaffolded all of the identity views, but they all go to the Areas folder - I would prefer if they went in my Views folder.
I moved the generated identity code to the desired Views folder, and ...
0
votes
1
answer
179
views
How do I add basic authentication on certain API calls in an ASP.NET Core website using Identity
I have an ASP.NET Core web application that is using Identity for authentication and authorization. This allows me to register users easily in the website and it all works as expected.
However, the ...
1
vote
1
answer
191
views
How do I set up a different cookie for authentication in an ASP.NET Core Web API?
Let me give you some context.
I am currently trying to implement a Refresh/Access token setup for my authentication and authorization.
I think I understand the idea and the purpose of each token. But ...
-1
votes
1
answer
58
views
Account controller throws exception when calling login
I'm reading through this book. It's using ASP.NET Core 6.
So far it's been very good, but now I've reached the chapter on authentication and authorization, and I'm getting an exception.
In the ...
1
vote
1
answer
55
views
How do I configure an ASP.NET Core app with identity as an authenticated NuGet feed?
I have an ASP.NET Core application using Identity for authentication/authorization that I'm trying to configure as a NuGet server. The NuGet server piece works great if I remove any Authorize ...
0
votes
1
answer
67
views
How to Configure Identity Server to Issue JWTs Instead of Cookies for Authentication in a Microservices App?
I set an Identity Server for Auth for my Microservices app.
program.cs
using System.Security.Claims;
using AuthMicroservice;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
...
0
votes
1
answer
263
views
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable" with external log in on Azure App Service
I am trying to login via an external provider on my Duende Asp.Net Identity Project. The project is hosted on Azure App Services. However when doing so, I get this error.
The resource you are looking ...
0
votes
1
answer
2k
views
How to include roles in a Microsoft Entra ID Access Token
I registered an app: test.com
Added App Roles:
Added User with Roles
Added API Permissions
But I don't see any roles-related claim in this list:
This is my backend code:
builder.Services.Configure&...
0
votes
1
answer
68
views
Multiple identities in ClaimsPrincipal with IsAuthenticated = false in JWT
I'm working on JWT authentication/authorization project, following this guide.
I have successfully wired up the JWT infrastructure and I'm able to login successfully and generate the required tokens.
...
1
vote
0
answers
70
views
How to handle foreign keys to the user table when using Microsoft Entra ID for authentication in ASP.NET Core?
I'm integrating Microsoft Entra ID (Azure AD) into my ASP.NET Core application for authentication. Since Entra ID is an external identity provider (SSO), I will no longer store users in my database, ...
1
vote
1
answer
61
views
Use ASP.NET Core Identity without Username field
I have been working with .NET projects regularly, and I have always used the Identity package from .NET Core. Recently I had to work on a project where the main identifier is not a username, but the ...
0
votes
1
answer
67
views
'No service for type 'Microsoft.AspNetCore.Identity.UserManager`1[Microsoft.AspNetCore.Identity.IdentityUser]' has been registered.'
I´m having a problem when trying to create a seed for a user in my c# mvc. this is my seed, I need to create a standard user for my Database:
public static class IdentitySeed
{
public static ...
0
votes
0
answers
100
views
ASP.NET Core Identity Cookie Stored But Not Being authorizing - Blazor Web App
I am trying to authenticate an user from Blazor to access resources on a ASP.NET Core Web API using ASP.NET Core Identity.
I have two authentication methods configured: JWT and Cookies.
When I login ...
0
votes
1
answer
239
views
Trouble when configuring authorization in ASP.NET Core Web API
Let me give you some context: I am trying to implement custom policies in an ASP.NET Core Web API while using JWT bearer tokens.
But for some reason when trying to reach the protected routes, this ...
1
vote
1
answer
50
views
Name of user in _layout page through Identity
I am working on project ,I want the name of user in _layout page through Identity in ( ASP .net core 9 MVC ) So when I signout I should seen the name of user.
@User.Identity!.Name
I am getting Email ...
1
vote
0
answers
51
views
How do I get the phone number & address from a Google account in Identity Library
I am using the ASP.NET Core 6 Identity library. I added in logging in using my Google account and that works fine. I now want to add getting the account's phone number and address. This is failing.
In ...
0
votes
0
answers
45
views
AspNetCore.Identity Custom implementation with MongoDb and claims
I want to use AspNetCore.Identity for my backend. I am using MongoDb, so I am creating a custom UserStore implementation. It is my first time setting this up and I am a little uncertain about the ...
0
votes
0
answers
21
views
.NET Core web application loses user session. How can I extend it?
I am using .NET Core identity in my web application.
This is how I am configuring the authentication:
var ab = services.AddAuthentication(IdentityConstants.ApplicationScheme)
.AddJwtBearer(x =>
...