### Client Credentials Grant: Successful Response Source: https://www.rfc-editor.org/rfc/rfc6749.txt Example 200 OK response from the token endpoint for a valid client credentials request. Includes access_token, token_type, expires_in, and an example_parameter. ```http HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token":"2YotnFZFEjr1zCsicMWpAA", "token_type":"example", "expires_in":3600, "example_parameter":"example_value" } ``` -------------------------------- ### MAC token usage example Source: https://www.rfc-editor.org/rfc/rfc6749.txt Shows how to include a MAC access token in an HTTP request using the Authorization header. The token type 'mac' is defined in OAuth-HTTP-MAC and requires a MAC key and signature. ```http GET /resource/1 HTTP/1.1 Host: example.com Authorization: MAC id="h480djs93hd8", nonce="274312:dj83hs9s", mac="kDZvddkndxvhGRXZhvuDjEWhGeE=" ``` -------------------------------- ### HTTP Basic Authentication Header for Client Password Source: https://www.rfc-editor.org/rfc/rfc6749.txt Example of an Authorization header using HTTP Basic authentication with the client identifier and password encoded as per Appendix B. The header value is 'Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3'. ```http Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3 ``` -------------------------------- ### Bearer token usage example Source: https://www.rfc-editor.org/rfc/rfc6749.txt Shows how to include a bearer access token in an HTTP request using the Authorization header. The token type 'bearer' is defined in RFC 6750. ```http GET /resource/1 HTTP/1.1 Host: example.com Authorization: Bearer mF_9.B5f-4.1JqM ``` -------------------------------- ### ABNF for type-name Source: https://www.rfc-editor.org/rfc/rfc6749.txt Defines the ABNF grammar for access token type names. Type names must conform to this syntax, and the token type 'example' is reserved for examples. ```abnf type-name = 1*name-char name-char = "-" / "." / "_" / DIGIT / ALPHA ``` -------------------------------- ### Token Request with Client Credentials in Request Body Source: https://www.rfc-editor.org/rfc/rfc6749.txt Example of a POST request to the token endpoint to refresh an access token, including client credentials (client_id and client_secret) in the request body. The request uses application/x-www-form-urlencoded content type. ```http POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=refresh_token&refresh_token=tGzv3JOkF0XG5Qx2TlKWIA &client_id=s6BhdRkqt3&client_secret=7Fjfp0ZBr1KtDRbnfVdmIw ``` -------------------------------- ### Access Token Request and Response Source: https://www.rfc-editor.org/rfc/rfc6749.txt Describes the access token request and response for the OAuth 2.0 authorization code grant flow. It includes request parameters, an example request, and the expected successful response format. ```APIDOC ## [POST] /token ### Description Requests an access token using the authorization code grant type. The client authenticates and exchanges the authorization code for an access token. ### Method POST ### Endpoint /token ### Parameters #### Request Body - **grant_type** (string) - Required - Must be set to "authorization_code". - **code** (string) - Required - The authorization code received from the authorization server. - **redirect_uri** (string) - Required if the "redirect_uri" parameter was included in the authorization request; its value must be identical. - **client_id** (string) - Required if the client is not authenticating with the authorization server. ### Request Example POST /token HTTP/1.1 Host: server.example.com Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Content-Type: application/x-www-form-urlencoded grant_type=authorization_code&code=SplxlOBeZQQYbYS6WxSbIA&redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb ### Response #### Success Response (200) - **access_token** (string) - The access token issued by the authorization server. - **token_type** (string) - The type of the token (e.g., "example"). - **expires_in** (integer) - Optional - The lifetime in seconds of the access token. - **refresh_token** (string) - Optional - The refresh token, if issued. - **example_parameter** (string) - Optional - An example extension parameter. #### Response Example { "access_token":"2YotnFZFEjr1zCsicMWpAA", "token_type":"example", "expires_in":3600, "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA", "example_parameter":"example_value" } ``` -------------------------------- ### POST /token request to refresh an access token Source: https://www.rfc-editor.org/rfc/rfc6749.txt Example HTTP request to the token endpoint to refresh an access token. It uses the application/x-www-form-urlencoded format and includes the grant_type and refresh_token parameters. The client authenticates using HTTP Basic authentication. ```http POST /token HTTP/1.1 Host: server.example.com Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Content-Type: application/x-www-form-urlencoded grant_type=refresh_token&refresh_token=tGzv3JOkF0XG5Qx2TlKWIA ``` -------------------------------- ### GET /authorize Source: https://www.rfc-editor.org/rfc/rfc6749.txt This is the authorization endpoint in OAuth 2.0, used to initiate the authorization code and implicit grant type flows. The client directs the resource owner's user-agent to this endpoint, which then handles user authentication and consent and redirects back to the client's redirection endpoint. ```APIDOC ## GET /authorize ### Description This is the authorization endpoint in OAuth 2.0, used to initiate the authorization code and implicit grant type flows. The client directs the resource owner's user-agent to this endpoint, which then handles user authentication and consent and redirects back to the client's redirection endpoint. ### Method GET ### Endpoint /authorize ### Parameters #### Query Parameters - **response_type** (string) - Required - The desired grant type. Must be one of "code" for the authorization code flow, "token" for the implicit flow, or an extension value. ### Request Example GET /authorize?response_type=code&client_id=...&redirect_uri=... ### Response #### Success Response (302) The authorization server redirects the user-agent to the client's redirection endpoint. #### Response Example HTTP/1.1 302 Found Location: https://client.example.com/cb?code=SplxlOBeZQQYbYS6WxSbIA ### Notes - The endpoint URI may include a query component, but must not include a fragment. - TLS is required. - Unrecognized parameters must be ignored; parameters without a value are treated as omitted; parameters must not be included more than once. ``` -------------------------------- ### HTTP/1.1 400 Bad Request with JSON error body Source: https://www.rfc-editor.org/rfc/rfc6749.txt Example of an error response from the authorization server when a token request fails. The response uses the application/json media type and includes the error parameter at the top level of the JSON structure. ```http HTTP/1.1 400 Bad Request Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "error":"invalid_request" } ``` -------------------------------- ### POST /token (Extension Grants) Source: https://www.rfc-editor.org/rfc/rfc6749.txt Requests an access token using an extension grant type, such as SAML 2.0 assertion. The grant_type parameter specifies an absolute URI defined by the authorization server. The response contains the access token and optional metadata. ```APIDOC ## POST /token (Extension Grants) ### Description Requests an access token using an extension grant type specified by an absolute URI. ### Method POST ### Endpoint /token ### Parameters #### Request Body - **grant_type** (string) - REQUIRED - Value MUST be set to an absolute URI defined by the authorization server. - **assertion** (string) - REQUIRED - The assertion (e.g., SAML 2.0 assertion) as defined by the extension grant type. ### Request Example ``` POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer&assertion=PEFzc2VydGlvbiBJc3N1ZUluc3RhbnQ9IjIwMTEtMDU... ``` ### Response #### Success Response (200) - **access_token** - REQUIRED - The access token issued by the authorization server. - **token_type** - REQUIRED - The type of the token issued. - **expires_in** - RECOMMENDED - The lifetime in seconds of the access token. - **refresh_token** - OPTIONAL - The refresh token, which can be used to obtain new access tokens. - **scope** - OPTIONAL - The scope of the access token. ``` -------------------------------- ### POST /token Source: https://www.rfc-editor.org/rfc/rfc6749.txt Requests an access token using the client credentials grant type. The client authenticates with the authorization server and sends the grant_type and scope parameters in the request body. The response contains the access token and optional metadata. ```APIDOC ## POST /token ### Description Requests an access token using the client credentials grant type. ### Method POST ### Endpoint /token ### Parameters #### Request Body - **grant_type** (string) - REQUIRED - Value MUST be set to "client_credentials". - **scope** (string) - OPTIONAL - The scope of the access request. ### Request Example ``` POST /token HTTP/1.1 Host: server.example.com Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Content-Type: application/x-www-form-urlencoded grant_type=client_credentials ``` ### Response #### Success Response (200) - **access_token** - REQUIRED - The access token issued by the authorization server. - **token_type** - REQUIRED - The type of the token issued. - **expires_in** - RECOMMENDED - The lifetime in seconds of the access token. - **refresh_token** - OPTIONAL - The refresh token, which can be used to obtain new access tokens. - **scope** - OPTIONAL - The scope of the access token. #### Response Example ``` HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token":"2YotnFZFEjr1zCsicMWpAA", "token_type":"example", "expires_in":3600, "example_parameter":"example_value" } ``` ``` -------------------------------- ### ABNF for param-name Source: https://www.rfc-editor.org/rfc/rfc6749.txt Defines the ABNF grammar for new endpoint parameter names. Parameter names must conform to this syntax, and parameter values must be well-defined. ```abnf param-name = 1*name-char name-char = "-" / "." / "_" / DIGIT / ALPHA ``` -------------------------------- ### Client Credentials Grant: Token Request Source: https://www.rfc-editor.org/rfc/rfc6749.txt HTTP request to the token endpoint using the client_credentials grant type. The client must authenticate (e.g., via Basic auth) and send parameters in application/x-www-form-urlencoded format. ```http POST /token HTTP/1.1 Host: server.example.com Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Content-Type: application/x-www-form-urlencoded grant_type=client_credentials ``` -------------------------------- ### Extension Grant: SAML 2.0 Assertion Token Request Source: https://www.rfc-editor.org/rfc/rfc6749.txt HTTP request using an extension grant type with a SAML 2.0 assertion. The grant_type is an absolute URI and the assertion parameter contains the SAML assertion (truncated for brevity). ```http POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2- bearer&assertion=PEFzc2VydGlvbiBJc3N1ZUluc3RhbnQ9IjIwMTEtMDU [...omitted for brevity...]aG5TdGF0ZW1lbnQ-PC9Bc3NlcnRpb24- ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.