#[non_exhaustive]pub enum GrantType {
Password,
AuthorizationCode,
ClientCredentials,
RefreshToken,
Other(i32),
}Expand description
Type of the resource owner’s authorization used by the client to obtain an access token. For more information, see section 1.3 of RFC 6749.
Grant types are used in the AccessTokenRequest.
§Example
For example, if you wish to indicate in your request that the resource owner’s authorization works via client credentials:
let request = AccessTokenRequest::builder()
.client_id("test_client")
.grant_type(GrantType::ClientCredentials)
.build()?;It’s also possible to use your own value for a custom grant type, as defined in section 8.5 of RFC 9200:
let request = AccessTokenRequest::builder()
.client_id("test_client")
// values below -65536 marked for private use.
.grant_type(GrantType::Other(-99999))
.build()?;Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Password
Grant type intended for clients capable of obtaining the resource owner’s credentials.
Note that the authorization server should take special care when enabling this grant type and only allow it when other flows are not viable.
See section 4.3 of RFC 6749 for details.
AuthorizationCode
Redirection-based flow optimized for confidential clients.
See section 4.1 of RFC 6749 for details.
ClientCredentials
Used when the client authenticates with the authorization server in an unspecified way.
Must only be used for confidential clients.
See section 4.4 of RFC 6749 for details.
RefreshToken
Used for refreshing an existing access token.
When using this, it’s necessary that refresh_token
is specified in the AccessTokenResponse.
See section 6 of RFC 6749 for details.
Other(i32)
Another authorization grant not listed here.
See section 8.5 of RFC 9200 for corresponding IANA registries.