OAuth2
WebAPI方式获取access_token
Request | API | Description |
---|---|---|
POST | ntWebAPI/v1/oauth2/queTokenAsync | 获取access_token |
POST | ntWebAPI/v1/oauth2/refTokenAsync | 根据refresh_token刷新access_token |
通过API方式,获取access_token
url: ntWebAPI/v1/oauth2/queTokenAsync
Request Information
- Body Parameters
Name | Description | Type | Additional information |
---|---|---|---|
grant_type | 请求类型:client_credentials | string | Required |
client_id | 客户端ID | string | Required |
client_secret | 客户端秘钥 | string | Required |
- Request Formats
application/json, text/json
{
"grant_type": "client_credentials",
"client_id": "newtype",
"client_secret": "hh7gsd1"
}
Response Information
- Resource Description
Name | Description | Type | Additional information |
---|---|---|---|
access_token | access_token | string | None. |
token_type | bearer | string | None. |
expires_in | access_token过期时间(秒) | string | None. |
refresh_token | refresh_token | string | None. |
refresh_expires_in | refresh_token过期时间(秒) | string | None. |
client_id | 客户端client_id | string | None. |
resultMSG | 请求结果信息(成功/失败信息提示) | string | None. |
- Response Formats
application/json, text/json
{
"access_token": "ZYlHPRoxb25Cae6rvQLA25XCZGB2WXqrwlwmy-cp6Zbm4gWHObO9OGw4IqiMhDjK-CsGoqDfWBiHyjWLQFIJ3SvpDrPac0f3dK57aDMje8hZl6fOlLjqNmjA_GrwOKWbDlTTASq4ZTngVCZwKgO_rdbQ3osQHfk0htsetiETMHCAiMQAdjiUR6CPPazrIIZlGmSCyWeheIdMyK_NWPiNt7Us2Hvd9CRjmTPq1k8dMMg",
"token_type": "bearer",
"expires_in": "299",
"refresh_token": "d9a3d3aa93414f6791f46538498dc4b30a8f6fe4e8b240aaaa535f3d7f66c27f",
"refresh_expires_in": "2592000",
"client_id": "ntAPI",
"resultMSG": "The request is successful"
}