| ... | @@ -17,6 +17,7 @@ http://pre.sovell.com/oauth/v2/userinfo |
... | @@ -17,6 +17,7 @@ http://pre.sovell.com/oauth/v2/userinfo |
|
|
```
|
|
```
|
|
|
client_id=B-8onb81TPCog2YBhSsQaA
|
|
client_id=B-8onb81TPCog2YBhSsQaA
|
|
|
client_secret=q1LQuI8C4CI
|
|
client_secret=q1LQuI8C4CI
|
|
|
|
domain=pre.sovell.com
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
- 生产环境Oauth2地址
|
|
- 生产环境Oauth2地址
|
| ... | @@ -24,11 +25,15 @@ client_secret=q1LQuI8C4CI |
... | @@ -24,11 +25,15 @@ client_secret=q1LQuI8C4CI |
|
|
http://pass.sovell.com/oauth/v2/authorize
|
|
http://pass.sovell.com/oauth/v2/authorize
|
|
|
http://pass.sovell.com/oauth/v2/token
|
|
http://pass.sovell.com/oauth/v2/token
|
|
|
http://pass.sovell.com/oauth/v2/check_token
|
|
http://pass.sovell.com/oauth/v2/check_token
|
|
|
http://pre.sovell.com/oauth/v2/userinfo
|
|
http://pass.sovell.com/oauth/v2/userinfo
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
- 生产环境终端信息根据实际情况配置
|
|
- 生产环境终端信息根据实际情况配置
|
|
|
|
|
|
|
|
|
```
|
|
|
|
domain=pass.sovell.com
|
|
|
|
```
|
|
|
|
|
|
|
### 终端方式授权
|
|
### 终端方式授权
|
|
|
|
|
|
|
|
- 这种方式只对client进行授权,没有用户信息
|
|
- 这种方式只对client进行授权,没有用户信息
|
| ... | @@ -53,11 +58,16 @@ http://pre.sovell.com/oauth/v2/userinfo |
... | @@ -53,11 +58,16 @@ http://pre.sovell.com/oauth/v2/userinfo |
|
|
1. 发送给某个手机
|
|
1. 发送给某个手机
|
|
|
|
|
|
|
|
```javascript
|
|
```javascript
|
|
|
GET /oauth/v2/code?phone=18768424633&title=我的短信 HTTP/1.1
|
|
GET /oauth/v2/code?phone=${phone}&title=${title} HTTP/1.1
|
|
|
Host: pre.sovell.com
|
|
Host: ${domain}
|
|
|
Authorization: Bearer it_is_a_token
|
|
Authorization: Bearer ${token}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|参数名|类型|说明|
|
|
|
|
|:---|:---|:---|
|
|
|
|
|phone|string|手机号|
|
|
|
|
|title|string|短信头|
|
|
|
|
|
|
|
1. 发送成功后不返回实际内容,HttpStatus=200即为成功
|
|
1. 发送成功后不返回实际内容,HttpStatus=200即为成功
|
|
|
|
|
|
|
|
1. 成功后调用/token接口
|
|
1. 成功后调用/token接口
|
| ... | @@ -66,12 +76,17 @@ http://pre.sovell.com/oauth/v2/userinfo |
... | @@ -66,12 +76,17 @@ http://pre.sovell.com/oauth/v2/userinfo |
|
|
|
|
|
|
|
```javascript
|
|
```javascript
|
|
|
POST /oauth/v2/token HTTP/1.1
|
|
POST /oauth/v2/token HTTP/1.1
|
|
|
Host: pre.sovell.com
|
|
Host: ${domain}
|
|
|
Content-Type: application/x-www-form-urlencoded
|
|
Content-Type: application/x-www-form-urlencoded
|
|
|
|
|
|
|
|
client_id=B-8onb81TPCog2YBhSsQaA&client_secret=q1LQuI8C4CI&grant_type=authorization_code&code=18768424633.3721
|
|
client_id=${client_id}&client_secret=${client_secret}&grant_type=authorization_code&code=${phone}.${code}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|参数名|类型|说明|
|
|
|
|
|:---|:---|:---|
|
|
|
|
|phone|string|手机号|
|
|
|
|
|code|string|收到的授权码|
|
|
|
|
|
|
|
> - grant_type必须为authorization_code
|
|
> - grant_type必须为authorization_code
|
|
|
|
|
|
|
|
### 二维码授权
|
|
### 二维码授权
|
| ... | @@ -156,8 +171,7 @@ http://pre.sovell.com/oauth/v2/userinfo |
... | @@ -156,8 +171,7 @@ http://pre.sovell.com/oauth/v2/userinfo |
|
|
|
|
|
|
|
```
|
|
```
|
|
|
POST /oauth/v2/token HTTP/1.1
|
|
POST /oauth/v2/token HTTP/1.1
|
|
|
Host: dev.sovell.com
|
|
Host: ${domain}
|
|
|
Content-Length: 96
|
|
|
|
|
Content-Type: application/x-www-form-urlencoded
|
|
Content-Type: application/x-www-form-urlencoded
|
|
|
|
|
|
|
|
code=card/001&client_id=fzU1cb7ESpuaVRThuBcYcQ&client_secret=abc&grant_type=offline_cert
|
|
code=card/001&client_id=fzU1cb7ESpuaVRThuBcYcQ&client_secret=abc&grant_type=offline_cert
|
| ... | @@ -196,9 +210,9 @@ http://pre.sovell.com/oauth/v2/userinfo |
... | @@ -196,9 +210,9 @@ http://pre.sovell.com/oauth/v2/userinfo |
|
|
|
|
|
|
|
```
|
|
```
|
|
|
POST /oauth/v2/userinfo HTTP/1.1
|
|
POST /oauth/v2/userinfo HTTP/1.1
|
|
|
Host: pre.sovell.com
|
|
Host: ${domain}
|
|
|
Content-Length: 96
|
|
Content-Length: 96
|
|
|
Authorization: Bearer b03344e6-3128-4dbb-b65e-90707c26088a
|
|
Authorization: Bearer ${token}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
> 使用授权的到的token
|
|
> 使用授权的到的token
|
| ... | | ... | |