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
http://localhost:5000/account/login?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DClient%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A49000%252Fsignin-oidc%26response_mode%3Dform_post%26response_type%3Did_token%2520token%2520code%26scope%3Dopenid%2520profile%2520testapi%26state%3DOpenIdConnect.AuthenticationProperties%253DEf4ItTF_eWXPU2OTCYP3CqKsds3ywXrsYSfwxnFQCa-p9LYjfJYPXl6OIJWlKVKAyyN1o_5zeox2Wff5SlXEasQ8r44igT72kaDTzUevTOFwh1pkQyDe9Cwxes3pmFNJJOtet2WRON9XnGkabWtuDYnTbumSqyI4pG_zgb6SsY9A6Fnd-rAPSWFPhsLNVJUXY9PRiw%26nonce%3D636740608058134855.YzdiZmQ2MDYtZmY0Zi00MWZjLTg2NmMtMTIxOGMxMDBlODgxNDZhY2Y1ODQtODNhYi00Yzc4LWIyMDQtYTE2MzhkZWMwYmIy
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 view your CDSL client id in the Demat Account Statement or on the broker website. A client id is unique to a Demat account. If you have more than one Demat account, each demat account will have a different client ID. CDSL client ID is a unique 8-digit number provided to every demat account by CDSL.
The Client ID is a public identifier of your application. The Client Secret is confidential and should only be used to authenticate your application and make requests to LinkedIn's APIs.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With