concept password grant type in category spring

appears as: password grt type, password grt type, The password grt type
Spring Security in Action

This is an excerpt from Manning's book Spring Security in Action.

Figure 1.13 The OAuth 2 authorization flow with password grant type. To execute an action requested by the user (1), the application requires an access token from the authorization server (2). The application receives a token (3) and accesses a resource from the resource server with the access token (4).

12.3.2    Implementing the password grant type

In this section, we discuss the password grant type (figure 12.7). This grant type is also known as the resource owner credentials grant type. Applications using this flow assume that the Client collects the user’s credentials and uses them to authenticate and obtain an access token from the authorization server. Remember our hands-on example in chapter 11? That architecture we implemented is quite close to what happens in the password grant type. We’ll also implement a “real” OAuth 2 password grant type architecture with Spring Security in chapters 13 to 15.

Figure 12.7 The password grant type assumes that the user shares their credentials with the Client. The Client uses them to obtain the token from the Authorization Server. It then accesses the resources from the resource server on behalf of the user.

The password grant type is less secure than the authorization code grant type, mainly because it assumes sharing the user credentials with the client app. While it’s true that it’s more straightforward than the authorization code grant type, and this is the main reason you’ll also find it used plenty in theoretical examples, try to avoid it in real-world scenarios. Even if the Authorization Server and the Client are both built by the same organization, you should first think about using the authorization code grant type. Take the password grant type as your second option.