oauth.authorize
This interface is implemented on the platform application (APP) server side and called by the SUD OpenPaaS server.
Obtain the authorization code. Valid for 5 minutes, single use only; once invalid, authorization must be re-initiated.
Call method:
- HTTPS call
HTTPS Call
http
GET {authorize_webhook}Request Parameters - Query
| Field | Type | Default | Required | Description |
|---|---|---|---|---|
| client_id | string | Yes | Application ID assigned by the platform to SUD | |
| redirect_uri | string | Yes | Callback SUD address after successful authorization; domain/path/port must match exactly (case-sensitive), no query parameters allowed | |
| response_type | string | Yes | Fixed value: code | |
| state | string | No | Anti-replay, random string |
Return Value
Object
The returned JSON data packet
Note: The
codeandstateof this interface are located directly at the top level of the response, not wrapped indata, which differs from the response structure of other interfaces.
| Field | Type | Description |
|---|---|---|
| ret_code | integer | Error code: 0 means success, non-0 means failure |
| ret_msg | string | Error message: returns "success" on success, returns the specific error reason on failure |
| code | string | Authorization code (returned only on success) |
| state | string | Returns the state from the request as-is |
Valid Values of ret_code
| Value | Description | Minimum Version |
|---|---|---|
| 0 | Request succeeded | |
| 40001 | invalid client_id, check whether client_id is correct | |
| 40002 | invalid redirect_uri, check whether the callback address matches the backend configuration | |
| 40003 | invalid response_type, confirm this field has the fixed value code |
cURL Request
bash
curl -X GET \
'{authorize_webhook}?client_id=YOUR_CLIENT_ID&redirect_uri=https://your.domain.com/callback&response_type=code&state=RANDOM_STATE_STRING'Success Response
json
{
"ret_code": 0,
"ret_msg": "success",
"code": "AUTHORIZATION_CODE",
"state": "RANDOM_STATE_STRING"
}Error Response
json
{
"ret_code": 40001,
"ret_msg": "invalid client_id"
}