App client authentication (login) and CQRS

Viewed 3798

I'm interested in practical scenarios of authentication/login in web application when CQRS pattern is used to build the system.

Say we using HTTP services for commands/queries. And authentication with JWT (or any other authentication token)

  • We send command LogInUser with credentials (HTTP request).
  • Server command handler checks credentials, writes events in the store (if using Event Sourcing).

What then? What should we return as the result of the command? Just ok result with authToken? Then client should query the state in the read service? In this case we just make the whole process longer. And this concern actually refers not only to authentication scenarios but also other scenarios when we send a command and expect to get the result of it execution as soon as possible.

I just would like to hear from people who implemented such things. Want to understand possible practical data/requests flows for authentication using CQRS.

1 Answers
Related