I have an Identity server 4 application using .net core. Everything is working fine. What i would like to do is Log the client that the user is logging in with as we have a number of third party applications and would like to track user login based upon application.
When a user hits the login form they get the following
The client id is in the url and I can see it coming though some of the Identity server 4 middle were logging. What i cant figure out is how to grab it out of HttpContext or some other variable that i have not been able to find. I have checked signinmanager as well and cant seem to find it there either.
Does anyone know where i can find the client id that of the application that the user is logging in with?
You can use the IIdentityServerInteractionService
to get the AuthorizationRequest
this object contains all the data about the current authorization request, including the ClientId property.
var context = await _interaction.GetAuthorizationContextAsync(returnUrl);
var clientId = context.ClientId;