Skip to content

Commit bc6a9de

Browse files
committed
[DOCS] Edits the get tokens API (#45312)
1 parent ec73e8c commit bc6a9de

File tree

1 file changed

+40
-13
lines changed

1 file changed

+40
-13
lines changed

x-pack/docs/en/rest-api/security/get-tokens.asciidoc

+40-13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Creates a bearer token for access without requiring basic authentication.
1212

1313
`POST /_security/oauth2/token`
1414

15+
[[security-api-get-token-prereqs]]
16+
==== {api-prereq-title}
17+
18+
* To use this API, you must have the `manage_token` cluster privilege.
1519

1620
[[security-api-get-token-desc]]
1721
==== {api-description-title}
@@ -45,33 +49,56 @@ The following parameters can be specified in the body of a POST request and
4549
pertain to creating a token:
4650

4751
`grant_type`::
48-
(string) The type of grant. Supported grant types are: `password`, `_kerberos`,
49-
`client_credentials` and `refresh_token`. The `_kerberos` grant type
50-
is supported internally and implements SPNEGO based Kerberos support. The `_kerberos`
51-
grant type may change from version to version.
52+
(Required, string) The type of grant.
53+
Supported grant types are: `password`, `_kerberos`,
54+
`client_credentials` and `refresh_token`.
55+
56+
`client_credentials`:::
57+
This grant type implements the Client Credentials Grant of OAuth2. It is geared
58+
for machine to machine communication and is not suitable or designed for the
59+
self-service user creation of tokens. It generates only access tokens that
60+
cannot be refreshed. The premise is that the entity that uses
61+
`client_credentials` has constant access to a set of (client, not end-user)
62+
credentials and can authenticate itself at will.
63+
64+
`_kerberos`:::
65+
This grant type is supported internally and implements SPNEGO based Kerberos
66+
support. The `_kerberos` grant type may change from version to version.
67+
68+
`password`:::
69+
This grant type implements the Resource Owner Password Credentials Grant of
70+
OAuth2. In this grant, a trusted client exchanges the end user's credentials
71+
for an access token and (possibly) a refresh token. The request needs to be made
72+
by an authenticated user but happens _on behalf_ of another authenticated user
73+
(the one whose credentials are passed as request parameters). This grant type is
74+
not suitable or designed for the self-service user creation of tokens.
75+
76+
`refresh_token`:::
77+
This grant type implements the Refresh Token Grant of OAuth2.
78+
In this grant a user exchanges a previously issued refresh token for a new access token and a new refresh token.
5279

5380
`password`::
54-
(string) The user's password. If you specify the `password` grant type, this
81+
(Optional^*^, string) The user's password. If you specify the `password` grant type, this
5582
parameter is required. This parameter is not valid with any other supported
5683
grant type.
5784

5885
`kerberos_ticket`::
59-
(string) base64 encoded kerberos ticket. If you specify the `_kerberos` grant type,
60-
this parameter is required. This parameter is not valid with any other supported
61-
grant type.
86+
(Optional^*^, string) The base64 encoded kerberos ticket. If you specify the
87+
`_kerberos` grant type, this parameter is required. This parameter is not valid
88+
with any other supported grant type.
6289

6390
`refresh_token`::
64-
(string) If you specify the `refresh_token` grant type, this parameter is
65-
required. It contains the string that was returned when you created the token
66-
and enables you to extend its life. This parameter is not valid with any other
91+
(Optional^*^, string) The string that was returned when you created the token,
92+
which enables you to extend its life. If you specify the `refresh_token` grant
93+
type, this parameter is required. This parameter is not valid with any other
6794
supported grant type.
6895

6996
`scope`::
70-
(string) The scope of the token. Currently tokens are only issued for a scope of
97+
(Optional, string) The scope of the token. Currently tokens are only issued for a scope of
7198
`FULL` regardless of the value sent with the request.
7299

73100
`username`::
74-
(string) The username that identifies the user. If you specify the `password`
101+
(Optional^*^, string) The username that identifies the user. If you specify the `password`
75102
grant type, this parameter is required. This parameter is not valid with any
76103
other supported grant type.
77104

0 commit comments

Comments
 (0)