OAuth 授权
构建授权地址
进入 HAP 授权页,用户同意后回调 redirect_uri 并带上 code。
授权 URL 可在应用开发配置中获取。
示例请求:
授权 URL 可在应用开发配置中获取。
示例请求:
https://[授权页域名]/oauth/authorize?response_type=code&client_id=[client_id]&redirect_uri=https://your-app.com/oauth/callback&state=[state]鉴权方式
OAuth 2.0 是面向第三方应用的用户授权机制。用户通过 OAuth 集成完成授权后,第三方应用可以在授权范围内以用户身份调用 API。
版本
请求地址
Query 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
response_type | string | 是 | 固定为 code 可选值: "code" |
client_id | string | 是 | OAuth 集成的 client_id |
redirect_uri | string<uri> | 是 | 授权回调地址,需与集成应用配置完全匹配(http/https) |
state | string | 否 | 客户端自定义状态值 |
响应参数
200授权成功示例回调| 名称 | 类型 | 描述 |
|---|---|---|
response | object | — |
curl -X GET "https://example.com/oauth/authorize?response_type=code&client_id=string&redirect_uri=http%3A%2F%2Fexample.com""https://example.com/callback?code=AUTH_CODE&state=abc123"