4.4.2. 访问令牌请求(4.4.2. Access Token Request)

4.4.2. 访问令牌请求

客户端通过使用按附录B“application/x-www-form-urlencoded”格式在HTTP请求实体正文中发送下列UTF-8字符编码的参数向令牌端点发起请求:

  • grant_type
    必需的。值必须设置为“client_credentials”。
  • scope
    可选的。如3.3节所述的访问请求的范围。

客户端必须如3.2.1所述与授权服务器进行身份验证。

例如,客户端使用传输层安全发起如下HTTP请求(额外的换行仅用于显示目的):

POST /token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials

授权服务器必须对客户端进行身份验证。

 

4.4.2. Access Token Request



   The client makes a request to the token endpoint by adding the
   following parameters using the "application/x-www-form-urlencoded"
   format per Appendix B with a character encoding of UTF-8 in the HTTP
   request entity-body:

   grant_type
         REQUIRED.  Value MUST be set to "client_credentials".

   scope
         OPTIONAL.  The scope of the access request as described by
         Section 3.3.

   The client MUST authenticate with the authorization server as
   described in Section 3.2.1.









Hardt                        Standards Track                   [Page 41]

 
RFC 6749                        OAuth 2.0                   October 2012


   For example, the client makes the following HTTP request using
   transport-layer security (with extra line breaks for display purposes
   only):

     POST /token HTTP/1.1
     Host: server.example.com
     Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
     Content-Type: application/x-www-form-urlencoded

     grant_type=client_credentials

   The authorization server MUST authenticate the client.