身份验证接口
接口简介
易点易动采用 OAuth2.0 协议实现身份认证,调用全部资源接口时,需在 HTTP 请求头中传入 access_token。
Authorization: Bearer {access_token}
请求未携带有效 access_token 时,资源服务端将返回 HTTP 401 Unauthorized 状态码,并在响应头中返回具体错误信息,示例如下:
http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="Yidea.Resource.Api", error="invalid_token", error_description="The access token is invalid"接口调用
调用服务端身份验证接口前,需先获取 access_token 凭证。
请求方式:
POST (HTTPS)
请求地址:
https://oauth.yideamobile.com/connect/token
x-www-from-urlencoded方式传值请求示例:
json
{
"grant_type": "password",
"client_id": "xxxxxx",
"username": "xxxxxx",
"password": "xxxxxx",
"EnterpriseKey": "xxxxxx"
}参数说明:
| 参数 | 是否必须 | 参数类型 | 说明 |
|---|---|---|---|
| grant_type | 是 | String | 使用授权类型,固定为"password" |
| client_id | 是 | String | 调用者身份标识1 |
| username | 是 | String | 易点易动账户名称 |
| password | 是 | String | 易点易动账户密码 |
| EnterpriseKey | 是 | String | 易点易动注册企业标识1 |
返回结果:
json
{
"access_token": "xxxxxx",
"expires_in": 7200,
"token_type": "Bearer"
}| 参数 | 参数类型 | 说明 |
|---|---|---|
| access_token | String | 身份认证服务为调用者颁发的access_token |
| expires_in | Int | access_token超时时间(秒) |
| token_type | String | access_token的认证类型 |
补充说明:
易点易动资源服务会识别调用者客户端和您的租户信息,请以管理员身份登录易点易动云平台,并在您的企业信息页面获取属于您的调用者客户端和企业标识