更新时间:2019-3-7
易点易动使用了基于OAuth2.0协议的身份认证服务,对于所有资源服务接口的调用都需要将access_token置于请求的HTTP Header中。
Authorization: Bearer {access_token}
未包含有效access_token的请求,资源服务器将返回HTTP 401 Unauthorized错误,并在返回的Response Header中描述错误的详情。如:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="Yidea.Resource.Api", error="invalid_token", error_description="The access token is invalid"
https://auth.yideamobile.com/connect/token
{
"grant_type":"password"
"client_id":"xxxxxx"
"username":"xxxxxx"
"password":"xxxxxx"
"EnterpriseKey":"xxxxxx"
}
参数 | 是否必须 | 说明 |
---|---|---|
grant_type | 是 | 使用授权类型,固定为"password" |
client_id | 是 | 调用者身份标识1 |
username | 是 | 登录账号 |
password | 是 | 登录密码 |
EnterpriseKey | 是 | 易点注册企业标识1 |
{
"access_token": "xxxxxx",
"expires_in": 7200,
"token_type": "Bearer"
}
参数 | 说明 |
---|---|
access_token | 身份认证服务为调用者颁发的access_token |
expires_in | access_token超时时间(秒) |
token_type | access_token的认证类型 |