May 23, 2021 OAuth 2.0 Series
Contract authorization contains a request and a response. Contract Authorization Request A contract authorization request contains the following parameters:
response_type | Have to. Must be set in a token. |
---|---|
client_id | Have to. When a client is registered, there is a client identity assigned by the authorization server. |
redirect_uri | Optional. The redirect URI registered by the client. |
scope | Optional. Request a possible scope. |
state | Optional (recommended). The state of any URI client that needs to be passed to the client request. |
Contract Authorization Response Contract authorization contains the following parameters. Note that the contract authorization response is not JSON:
access_token | Have to. The access token assigned by the authorization server. |
---|---|
token_type | Have to. The token type. |
expires_in | Recommended. The number of seconds the access token expired. |
scope | Optional. The scope of the access token. |
state | Have to. i If it occurs during an authorization request, it is the same as the state parameter in the request. |
If an error occurs during authorization, two things can happen. I n the first case, the client is not authorized or identified. F or example, the URI is incorrectly redirected in the request. I n this case, there is no need for the authorization server to redirect the resource owner to the redirect URI, but rather to notify the resource owner that an error has occurred. T he second scenario is that the client is good, but something else happens. In this case, the following error response is sent to the client, including in the redirect URI:
error | Have to. M ust be one of the predefined error codes. See the specification to check these error codes and what they mean. |
---|---|
error_description | Optional. A text encoded by UTC-8 that describes an error. For developers, not end users. |
error_uri | Optional. A URI that points to a Web page that contains human-readable error messages. |
state | Have to. If it occurs during an authorization request, it is the same as the state parameter in the request. |