#### 接口路徑:https://dev.lingju.ai/httpapi/authorize.do
<table style="width:100%">
<tbody>
<tr height="28" style="font-weight:bold;">
<td height="28" width="130px" >名稱</td>
<td colspan="3" >授權認證接口</td>
</tr>
<tr height="28" style="font-weight:bold;">
<td height="28" >接口路徑</td>
<td colspan="3" >https://dev.lingju.ai/httpapi/authorize.do</td>
</tr>
<tr height="28" style="font-weight:bold;">
<td height="28" >請求方式</td>
<td colspan="3" >get/post</td>
</tr>
</tbody>
</table>
#### http get請求示例:
~~~
用于硬件平臺:
https://dev.lingju.ai/httpapi/authorize.do?appkey=xxxxx&userid=xxxx&authcode=xxxxx
用于軟件平臺:
https://dev.lingju.ai/httpapi/authorize.do?appkey=xxxxx&userid=xxxx
~~~
#### 請求參數說明:
<table style="width:100%">
<thead>
<tr height="28">
<th width="130px">參數</th>
<th width="100px">數據類型</th>
<th width="130px">可需</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr height="23" style="height:17.25pt">
<td height="23" >appkey</td>
<td >String</td>
<td>必填</td>
<td >分配給開發者的專屬appkey,請妥善保管</td>
</tr>
<tr height="92" >
<td height="92">userid</td>
<td>String</td>
<td>必填</td>
<td >終端用戶的唯一標識,移動設備建議使用mac地址,入網許可號等,注意取值必須為:[A-Za-z0-9]。請開發者務必注意區分userid,智能云根據userid標識終端id并實現授權限制及個性化的上下文應答。</td>
</tr>
<tr height="69" style="height:51.75pt">
<td>authcode</td>
<td>String</td>
<td>用于硬件必填<br/>軟件不填</td>
<td>給開發者分配的授權碼,由開發者自行管理</td>
</tr>
</tbody>
</table>
#### 接口返回JSON示例:
~~~
{
"description":"success",
"data":{
"accessToken":"9dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"expires":87,
"update":147xxxxxxxxxxxxx,
},
"status":0
}
~~~
#### 接口返回說明:
~~~
Content-Type:application/json;charset=UTF-8
~~~
<table style="width:100%">
<thead>
<tr height="28" >
<th height="28" width="130px">屬性名</th>
<th width="100px">數據類型</th>
<th colspan="2">描述</th>
</tr>
</thead>
<tbody>
<tr height="23">
<td height="23" >status</td>
<td>int</td>
<td colspan="2">狀態碼,0=成功,其它值則為錯誤碼,請參考錯誤碼表</td>
</tr>
<tr height="23">
<td height="23" >description</td>
<td >String</td>
<td colspan="2">通常為空,出錯時會有錯誤信息</td>
</tr>
<tr >
<td rowspan="3" >data</td>
<td rowspan="3" >JSON</td>
<td width="50px">accessToken</td>
<td>訪問碼,string</td>
</tr>
<tr >
<td width="50px">expires</td>
<td>有效期,int,天數</td>
</tr>
<tr >
<td width="50px">updated</td>
<td>時間戳,long</td>
</tr>
</tbody></table>
**請注意:每臺設備每個月可調用該接口10次獲取“accessToken”,該授權接口獲取到的accessToken有效期是30天,開發者只需要定時每30天獲取一次“accessToken”保存下來提供給聊天接口調用即可。該接口的流程建議放在開發者服務端來完成,開發者服務端將獲得的“accessToken”返回到用戶端進行機器人對話。該流程不是強制性要求,開發者也可在用戶端(app端)進行auth授權獲取“accessToken”,但需注意此做法容易泄漏appkey及授權碼,若引發損失請開發者自行負責**。