oAuth授权

POST /esignglobal/v1/oauth2/accessToken

接口描述

通過 app_id 和 app_secret 獲取鑒權 BEARER_TOKEN,用來請求後續業務 API。Token 有效時長為 24 小時。

請求參數

參數名稱

類型

必填

說明

client_id

string

true

應用帳號,即 app_id

請先註冊 eSignGlobal 帳號並創建應用後獲取。

client_secret

string

true

應用密碼,即app_secret

請先註冊 eSignGlobal 帳號並創建應用後獲取。

grant_type

string

true

授權類型,支持以下類型:

Client_credentials

Authorization_code

Refresh_token

codestringfalse

授權碼,用戶授權完成後由eSignGlobal返回,grant_type為Authorization_code時必傳

refresh_tokenstringfalse

刷新token,只有在grant_type為refresh_token時,才需要提供刷新令牌

請求示例

curl --location 'http://………………/esignglobal/v1/oauth2/accessToken' \
--form 'client_id="LZn…………g89"' \
--form 'client_secret="5ugL0rM………………Yne7b"' \
--form 'grant_type="client_credentials"' \

響應參數

參數名稱

類型

說明

access_token

string

鑒權 Token,用於接口請求鑒權

expires_in

int

Token 距離過期剩餘的時間

單位:秒

scope

string

權限範圍

  • 當grant_type為client_credentials時,返回固定值:read-write

  • 當grant_type為Authorization_code或Refresh_token時,返回對應的授權範圍

token_type

string

Token 類型

固定值:bearer

refresh_tokenstring

用於刷新token,僅當grant_type為authorization_code或refresh_token時返回,有效期為30個自然日,過期後需要重新授權

響應示例

{
    "access_token": "eyJhbGciOiJIUzI1N………………th1pMM3oYk",
    "expires_in": 86398,
    "scope": "read-write",
    "token_type": "bearer"
}

 

接口描述
請求參數
請求示例
響應參數
響應示例