Farukh
Farukh

Reputation: 2223

OAuth 2.0 Client Credentials get user id

I am using Identity Server 3 and following example from here. Client Credentials using OAuth 2.0.

I overwritten AuthorizeAttribute but when I look at the ClaimsIdentity Name and Actor are null. Is this by design? I am responsible to populate them? If so how? I see that Claims has client_id but why it's not getting reflected in Name or Actor?

Q: How can I get identity of who is calling?

actionContext.RequestContext.Principal.Identity

Upvotes: 0

Views: 1914

Answers (1)

Kahbazi
Kahbazi

Reputation: 15005

We have two definition in OAuth, User and Client

User is a human participant which basically has username and password.

Client is an application which User use which has a client_Id and client_secret.

When you using Client Credentials there is no User involved, and only clientId and ClientSecret is sent, therefor both Actor and Name property is null, because these properties are bind to user. In this case you should use Password, Code or Implicit Grant Type which have user involved.

Upvotes: 1

Related Questions