Questions tagged [asp.net-identity]
The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems. Use the ASP.NET Core Identity tag for questions about Identity in ASP.NET Core.
asp.net-identity
9,039 questions
0
votes
1
answer
736
views
cannot bind TokenAcquirerFactory to azure app configuration(daemon application calling a custom Web API)
I have been following this tutorial to create daemon application calling a custom Web API with its own identity using a CIAM tenant.
https://github.com/Azure-Samples/ms-identity-ciam-dotnet-tutorial/...
0
votes
0
answers
38
views
How to implement GenericRepository and UnitOfWork with Identity.EntityFrameWorkCore and My own entities together
I am facing a challenge while implementing a generic repository with a unit of work pattern in my ASP.NET Core project. The issue arises when I attempt to inherit from IdentityDbContext in my custom ...
0
votes
1
answer
228
views
How to proxy cookie authentication to an internal API
I use MS identity for a simple authentication using a cookie and username/password method. It's an MVC app where everything is wired up using standard MS Identity AddAuthentication + AddCookie. On ...
0
votes
1
answer
247
views
Disable Login details from being autofilled into input fields .Net Core Identity
When I want to create an account I don't want any fields being populated by chrome passwords as I have a hidden field that appears if a certain option is selected from a select. The field is shown, ...
0
votes
1
answer
372
views
How to update password in Blazor?
I did the registration/Login on my Razor Pages. But I want to do some sort of "Edit Profile" Page in my blazor Server App component. So initially my idea was to get the UserName via ...
0
votes
1
answer
1k
views
Isolated Azure Function Authentication via Code
Is there a built-in way to setup an isolated Azure Function to use Microsoft.Identity authentication similar to a Web API or MVC app using ...
0
votes
1
answer
345
views
Identity Server: Refresh Token for the currently Authenticated User
Authentication configuration:
...
1
vote
1
answer
185
views
Blazor - Targeting a specific user in SignalR
We're developing a feature that will allow us to allow users to only use our product on one device at a time, and one of the prerequisites for this feature is the ability to remotely log out a given ...
0
votes
1
answer
669
views
HttpContext.User.Identity.Name always returning null
I'm using the B2C ID Provider. The authentication part in my app is working correctly. However, I'm encountering an issue when attempting to retrieve information about the logged-in user. The ...
0
votes
1
answer
660
views
Role hierarchy in ASP.NET Identity?
Is there a recommended/built-in way to implement Role hierarchies in ASP.NET Identity? I have four roles: Master, Admin, Manager, and Restricted. I want to develop a safe method for determining which ...
-1
votes
1
answer
2k
views
How to generate Access Token or Authorization Code without user password in ABP Framework?
I want to implement a passwordless authentication in ABP project. In my scenario, I want to authenticate mobile users with their phone number by sending a verification code via SMS, then give these ...
3
votes
1
answer
2k
views
Where does the CascadingParameter HttpContext come from in a Blazor server side app with identity?
Im currently learning blazor identity and am analyzing the built in identity files. Im not one to just use something without knowing more about what its doing so i was just curious if anyone could ...
3
votes
1
answer
1k
views
ASP.NET Core Identity returns 404 instead of 401
I am trying to use ASP Identity with a .NET 8 Web API. I have the following in my Program.cs.
...
0
votes
1
answer
198
views
Asp.Net Identity - Migration update results in error "There is already an object named 'AspNetRoles' in the database."
I have a fresh SQL Server database, hosted in Microsoft Azure.
Whenever I run the following commands in the Visual Studio for Mac terminal window:
...
0
votes
1
answer
110
views
C# Asp.Net MVC Core Identity - Migration is ignoring new columns in ASPNETUsers table
I have a fresh SQL Server database, with no tables in it, hosted in Azure.
I have an ApplicationUser entity, that inherits from ...
-1
votes
1
answer
177
views
Exclude my REST APIs from site authentication?
I have an ASP.NET Core application with both web pages and APIs (using controllers).
It's working fine except, right now, if I attempt to access an API, I get redirected to the login page.
I'd like my ...
1
vote
0
answers
215
views
How to switch Authenticate Scheme at runtime based on request header
I'm trying to change an existing web API to allow switching between IdentityServer and JWT based authentication. Both forms of authentication work on their own when set to be the ...
0
votes
1
answer
131
views
Trailing Whitespaces Appended to Fixed-Length Property in Entity Framework Core
I'm facing an issue in my .NET 8 application where trailing whitespaces are being appended to a fixed-length property (UserName) when stored in the database. I am using Database provider - Microsoft....
0
votes
1
answer
382
views
Why Authorize attribute not working with this Configuration?
Thats how my Jwt configuration looks like:
...
0
votes
1
answer
208
views
Authenticating against web api with Local (individual) accounts from .NET Desktop (WPF/WinUI3)
I am looking to develop a series of applications including web, API and Windows desktop; the web application will support local "Individual" (ASP.NET Identity) accounts (as in stored in the ...
0
votes
1
answer
109
views
LockoutEnd not set to null when creating a new user in ASP.NET Identity
To create a new user I'm doing:
...
4
votes
4
answers
4k
views
How to actually implement Roles in Blazor WebApp and Identity?
So, here's the thing: If you create a Blazor WebApp (.Net8) with individual accounts enabled, it will give you a working solution. For development, I'm using Sqlite. Here's what that looks like (in an ...
3
votes
0
answers
599
views
Connect Elsa v3 to Azure AD
How do you setup Azure AD authentication with Elsa v3?
In Elsa v2, we did something like this and just wrapped Elsa in a login flow:
...
1
vote
1
answer
82
views
Role Based authorization not working after JWT is added to .Net Identity
After adding Jwt authentication to the Web API, it seems okay if I do not specify roles in the Weather Forecast Controller method. After I specified Roles, only JWT authorisation works. I tried ...
2
votes
0
answers
87
views
How to STOP the ASP.NET Identity API from creating a DbContext on every request when using services.AddDefaultIdentity()?
I am using the ASP.NET Identity API in ASP.NET 8, using the following code in Program.cs:
...
1
vote
1
answer
155
views
RoleExistsAsync always returning false despite roles being seeded in .NET Core 8 Identity
I'm encountering an issue with role management in my .NET Core 8 Web API project using Identity for authentication. I have successfully seeded roles to the database during the OnModelCreating method, ...
0
votes
0
answers
53
views
OnConfiguring event of the Identity Context class does not fire when writing a record to the AspNetUsers table
I'm using Identity in Asp.net core and my context inherits from a NetDevPackAppDbContext class which is a very cool assembly created by Eduardo Pires. I'm overriding the "OnConfiguring" ...
1
vote
0
answers
540
views
How to modify the properties of .NET 8 identity bearer token
I want to use the .NET 8 identity feature in my project but I want a way to review and possibly modify some of the properties like expiration time of the token and the refresh token, the issuer, the ...
1
vote
0
answers
348
views
DuplicateUsername error in Microsoft.AspNetCore.Identity.UserManager.CreateAsync
Using Microsoft.AspNetCore.Identity.EntityFrameworkCore 5.0.9.
I am trying to create a new user with something like
...
0
votes
1
answer
29
views
Parent object is null in one-to-many relationship extending IdentityUser
I am trying to extend ASP.NET IdentityUser to include a reference to a Customer.
I extend the IdentityUser class as:
...
2
votes
0
answers
88
views
Can't call my API with .AddOpenIdConnect() Configuration
In blazor asp.net core 6.0 hosted I'm trying to authorize with an external Identity Provider with OpenId-connect. This is the configuration which I've tried:
...
0
votes
1
answer
516
views
'IServiceCollection' does not contain a definition for 'AddDefaultIdentity' and no accessible extension method in Asp.Net Core Identity
I apply this line in Startup.cs in asp.net Core 6.0.
services.AddDefaultIdentity<IdentityUser>(options =>
{
Severity Code Description Project File ...
1
vote
1
answer
325
views
ASP.NET Identity library - delete user does not delete their claims
I am using the ASP.NET Core Identity library in Blazor server side version 8.
The library provides a page for a user to delete themselves from the system. When they are deleted - it does not delete ...
3
votes
3
answers
2k
views
Need to solve Blazor SSR Page using Mudblazor giving error on form submit
I am trying to build a Blazor Server Side app with Microsoft Identity Authentication. I am also using Mudblazor for UI since I don't know Css. The login page needs to be SSR for Identity on Blazor SSR ...
0
votes
1
answer
890
views
Blazor .NET 8 Auto Services with Auth-Required
I would like to migrate from my Blazor WASM/ASP .NET Core Web API to the new Blazor .NET 8 Auto. I have now moved all my services from the Web API to the server project.
But now the question is how I ...
0
votes
1
answer
151
views
Blazor server and ASPNET Identity: going through FW only works when certificate has the same DNS name as the site in the subject alternative name
We're seeing a weird behavior on an existing Blazor Server web app which uses ASP.NET Identity for managing is users (this app wasn't developed by our dev team and we don't have access to the team ...
15
votes
4
answers
10k
views
How to customize ".NET 8 Identity" routes - MapIdentityApi
I added the new identity endpoint from .NET 8 with .MapIdentityApi().
How can I expand the "/register" and "/login" endpoint to allow the ...
0
votes
0
answers
30
views
I am using Identity server 4 oidc authentication but when ever I apply authorize attribute then I am getting this - Token was not authenticated
This is the logging I am getting
enter image description here
Configurations -
...
1
vote
0
answers
23
views
OnActionExecutionAsync handling of RedirectToActionResult with AddDefaultIdentity vs AddIdentity
I spent quite a bit of time on this. So, I think I'm making a fundamental mistake.
It's easy to explain, but I'm not sure how much code I need to provide.
It's .NET Core 7, MVC, where the Base ...
0
votes
1
answer
90
views
Site-level [Authorize] in ASP.NET Core Web App (Model-View-Controller)
I'm writing small internal web app (decided to try asp.net for the first time). This app has no public pages, so i need to lock down every page.
First, i started to write this code in every single ...
0
votes
1
answer
402
views
"Access Denied" page ASP.NET Core Identity
I want to setup my "Access Denied" page
I use:
Microsoft.AspNetCore.Identity.UI ver. 8.0.0
Microsoft.AspNetCore.Identity.EntityFrameworkCore ver. 8.0.0
I ...
0
votes
1
answer
178
views
How to create User and Role for Admin in .NET 7?
When the database is created, it is empty and I need to have a model for the user in the AspNetUsers table and a role for example admin in AspNetRoles and also in the AspNetUserRoles model these two ...
1
vote
1
answer
86
views
How to ensure that messages in chat app are displayed immediately to the recipient
I am working on creating a one-to-one chat application using ASP.NET Core MVC, Identity, and SignalR. However, I'm encountering an issue where, after selecting a user from a list and sending them a ...
0
votes
1
answer
46
views
How do I track every time a user connects (with a cached login)?
I want to track every time a user connects to my app (saving the DateTime and remote IP). This is easy when they have to log in.
But, I use the ASP.NET Core Identity Library and it saves the login ...
2
votes
3
answers
591
views
How to include relation with another entity, when using UserManager?
I'm using ASP Identity's UserManager to fetch users in particular roles.
...
0
votes
1
answer
63
views
Need to pass current user to gridview using stored procedure and control parameter
I'm trying to create an orientation for newly signed in accounts. I have the AspNetUsers table that Identity populates to by default, but I have created ...
0
votes
2
answers
900
views
How to show assigned user roles in ASP.NET?
I am learning ASP.NET Razor Pages. I am trying to learn Authorization process by making a simple web application with Users and Roles that have different levels of access .
I could make Users and ...
0
votes
0
answers
51
views
.Net Core + React + Identity server. returnUrl returns 'template Url' instead of 'Url from which I was redirected'
I have net7.0 + React + Identity server (template project with user identity)
The problem is: After Authorization I redirected back not on a page from which I was redirected to Authorization.
Example :...
3
votes
1
answer
2k
views
How do you redirect to a specific page after login in blazor, using AspNetCore Identity?
I created a new Blazor project using the new .Net 8 Blazor Web App, and included Automatic Render mode and Individual Account authentication. All the bells and whistles.
I'm writing a site where it's ...
0
votes
1
answer
34
views
Getting "InvalidToken" response sometimes on EmailConfirmation in Prod environment only
I am working on a .NET 7 project. I wanted to extend the email confirmation token expiration to five days. I used the following implementation:
...