开发者中心POST /oauth/token (身份验证)
POST /oauth/token (身份验证)
介绍
在使用我们的 API 之前,你必须先用你的 API key 与 API secret 使用本 API 取得 access token。你取得的 access token 会在两小时过期,过期后你必须再次使用本 API 再次取得新的 access token。这样的身份验证机制能够让我们确保是你本人在使用你的账户,不会有别人来盗用你的余额来发布任务。
HTTP Request
URL
https://account.crowdsdom.com/oauth/token
HTTP Method
POST
HTTP Header
Content-Type: application/json
HTTP Basic Auth
YOUR_API_KEY:YOUR_API_SECRET
参数
Body
以下的参数在 http 请求的 Body 中以 JSON 的格式传入。
名称 | 描述 | Type | Default | Required |
---|---|---|---|---|
grant_type | 请求授权的类型,请填入 client_credentials |
String | None | Yes |
回复
名称 | 描述 | Type | Default |
---|---|---|---|
access_token | id: access token 的专属识别号,之后的 API 请求均必须附上此 id clientID: 用户的 API key ttl: access token 的存活时间 (秒),预设为7200 |
Object | None |
token_type | access token 的类别 | String | Brearer |
示例
以Python requests 直接调用 API 接口为例:
请求
1 | # -*- encoding: utf-8 -*- |
回复
1 | { |