Token 服务 ==================== 用途 ---- 使用用户名和密码换取访问令牌(JWT),供其他服务鉴权使用. 用户注册请访问 https://www.shinnytech.com/ 用户中心. 基础信息 -------- - 协议:HTTPS - 返回类型:``application/json; charset=utf-8`` - 服务地址:``https://edb.shinnytech.com`` 接口:POST /token ----------------- 请求体(JSON) ^^^^^^^^^^^^^ +----------+------+--------+--------------+ | 参数名 | 必填 | 说明 | 示例 | +==========+======+========+==============+ | username | 是 | 账户 | shinny_user | +----------+------+--------+--------------+ | password | 是 | 密码 | pw123 | +----------+------+--------+--------------+ 响应 ^^^^ :: {"token": ""} 错误返回为纯文本,例如 ``401, Unauthorized``. 调用示例 -------- .. code-block:: bash curl -X POST "https://edb.shinnytech.com/token" \ -H "Content-Type: application/json" \ -d '{"username":"shinny_user","password":"pw123"}' .. code-block:: python import requests resp = requests.post( "https://edb.shinnytech.com/token", json={"username": "shinny_user", "password": "pw123"}, timeout=5, ) resp.raise_for_status() print(resp.json())