Grant Types


The methods or processes that client applications utilise to request an access token from the authorization server are referred to as grant types in OAuth. Every grant type has been created to handle various circumstances, security needs, and client capabilities.

Here are some commonly used grant types in OAuth 2.0:

1. Authorization Code Grant:

This grant type is appropriate for server-side and web applications. The user is sent by the client application to the authorization endpoint of the authorization server, where they must give their permission. The client then trades the authorization code for an access token and, if desired, a refresh token from the authorization server.

2. Implicit Grant:

JavaScript applications and browser-based applications both commonly use this grant type. Without having to go through the extra process of acquiring an authorization code, it enables the client application to get the access token straight from the authorization endpoint.

3. Resource Owner Password Credentials Grant:

With this grant type, the user's username and password may be immediately exchanged for an access token by the client application. It is suitable when the client application is trusted and has a high degree of control over the user's credentials.

4. Client Credentials Grant:

Confidential clients (such as server-side applications) can use this grant type to authenticate themselves and get an access token from the authorization server without engaging a user.

5. Refresh Token Grant:

Using a refresh token received by a previous grant type, this grant type is used to get a new access token. It makes it possible for the client programme to get fresh access tokens without involving the user.

  • These are just a few examples of OAuth grant types. The specific grant types supported and their usage depend on the OAuth implementation, the authorization server, and the requirements of the client application.

  • When implementing OAuth, it's crucial to select the appropriate grant type based on factors such as the application type, security considerations, and the level of user involvement desired during the authentication and authorization process.