Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
D documents
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pass
  • documents
  • Wiki
  • Home

Home · Changes

Page history
Update home authored Dec 06, 2018 by 叶佳菲's avatar 叶佳菲
Hide whitespace changes
Inline Side-by-side
Showing with 94 additions and 4 deletions
+94 -4
  • home.md home.md +94 -4
  • No files found.
home.md
View page @ cb84149e
### OAuth2
[[_TOC_]]
# OAuth2授权
- 授权的具体过程参见文档 [rfc6749](https://tools.ietf.org/html/rfc6749)
- 参见 [OpenID Connect](http://openid.net/connect/)
......@@ -26,10 +28,92 @@ http://pass.sovell.com/oauth/v2/check_token
- 生产环境终端信息根据实际情况配置
### 交易接口
### 短信授权
- 短信授权实际上扩展了code方式的授权过程
1. 发送给某个手机
```javascript
GET http://{domain}/oauth/v2/code?phone=13606526033&title=我的短信 HTTP/1.1
Authorization: Bearer {token}
```
|参数名|类型|说明|
|:---|:---|:---|
|其他||见`公共请求参数说明`|
1. 发送成功后不返回实际内容,HttpStatus=200即为成功
1. 成功后调用/token接口
- 手机收到的授权码作为code参数
- 可参考 文档rfc6749 4.1.3s
[文档rfc6749 4.1.3](http://www.rfc-editor.org/rfc/rfc6749.txt)
### 二维码授权
- 二维码授权实际上扩展了code方式的授权过程
1. 取CODE
```javascript
GET http://{domain}/oauth/v2/code HTTP/1.1
Authorization: Bearer {token}
```
1. 调用成功后返回auth_code,将其生成二维码
1. 调用/token接口
- 子系统通过二维码解码作为code参数
- 可参考 文档rfc6749 4.1.3s
[文档rfc6749 4.1.3](http://www.rfc-editor.org/rfc/rfc6749.txt)
- 参见 [交易接口](接口/交易)
### 物理卡授权
1. 读出物理卡号
1. 调用/token接口
- 将`物理卡号`以card/${物理卡号}的形式赋值code
- grant_type=offline_cert
```
POST /oauth/v2/token HTTP/1.1
Host: dev.sovell.com
Content-Length: 96
Content-Type: application/x-www-form-urlencoded
code=card/001&client_id=fzU1cb7ESpuaVRThuBcYcQ&client_secret=abc&grant_type=offline_cert
```
1. 返回token
- 返回roles中会附加card角色
- `st`卡状态,lost表示挂失,不输出表示正常
```
HTTP/1.1 200 OK
Server: nginx/1.11.6
Date: Thu, 25 Oct 2018 02:09:13 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 254
Connection: keep-alive
Cache-Control: no-store
Pragma: no-cache
{
"access_token": "271952ee-a0b6-4360-9edd-e9052bb494d7",
"token_type": "bearer",
"refresh_token": "7abbd5ba-7704-4ba8-bc63-484997ce0659",
"expires_in": 7199,
"scope": "pass:payment openid",
"sub": "6aeca60613e949f0a16e721faf9f1082",
"roles": "root card",
"card": "001",
"st": "lost"
}
```
# 交易接口
- 测试环境地址
```
......@@ -39,4 +123,10 @@ http://pre.sovell.com/sovellpay/v2
- 生产环境地址
```
http://pass.sovell.com/sovellpay/v2
```
\ No newline at end of file
```
1. 在http请求头中设置OAuth2授权返回的access_token
> Authorization: Bearer ${access_token}
2. 参见 [交易接口](接口/交易)
Clone repository
  • Home
  • 接口
    • 交易
    • 消息
    • 用户
    • 通用券
  • 渠道
    • 微信 1基本参数
    • 微信 2商户平台配置
    • 微信 3公众号参数
    • 微信 4公众平台配置
    • 微信(服务商方式)
    • 支付宝 1基本参数
    • 支付宝 2公钥上传
    • 支付宝(服务商方式)