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

Last edited by 叶佳菲 Aug 01, 2019
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Home

  • OAuth2授权
    • 终端方式授权
    • 短信授权
    • 二维码授权
    • 物理卡授权
  • 交易接口

OAuth2授权

  • 授权的具体过程详见 rfc6749

  • OpenID标准

  • 测试环境OAuth2地址

http://pre.sovell.com/oauth/v2/authorize
http://pre.sovell.com/oauth/v2/token
http://pre.sovell.com/oauth/v2/check_token
  • 测试环境终端信息
client_id=B-8onb81TPCog2YBhSsQaA
client_secret=q1LQuI8C4CI
  • 生产环境Oauth2地址
http://pass.sovell.com/oauth/v2/authorize
http://pass.sovell.com/oauth/v2/token
http://pass.sovell.com/oauth/v2/check_token
  • 生产环境终端信息根据实际情况配置

终端方式授权

  • 这种方式只对client进行授权,没有用户信息
  • 详见 rfc6749
  1. 接口调用示例

    POST /oauth/v2/token HTTP/1.1
    Host: pre.sovell.com
    Content-Type: application/x-www-form-urlencoded
    
    grant_type=client_credentials&client_id=B-8onb81TPCog2YBhSsQaA&client_secret=q1LQuI8C4CI
    • grant_type必须为client_credentials

短信授权

  • 短信授权实际上扩展了code方式的授权过程
  1. 发送给某个手机

    GET http://{domain}/oauth/v2/code?phone=13606526033&title=我的短信 HTTP/1.1
    Authorization: Bearer {token}
    参数名 类型 说明
    其他 见公共请求参数说明
  2. 发送成功后不返回实际内容,HttpStatus=200即为成功

  3. 成功后调用/token接口

    • 手机收到的授权码作为code参数
    • 可参考文档rfc6749

二维码授权

  • 二维码授权实际上扩展了code方式的授权过程
  1. 取CODE

    GET http://{domain}/oauth/v2/code HTTP/1.1
    Authorization: Bearer {token}
  2. 调用成功后返回auth_code,将其生成二维码

  3. 调用/token接口

    • 子系统通过二维码解码作为code参数
    • 可参考文档rfc6749 4.1.3

物理卡授权

  1. 读出物理卡号

  2. 调用/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
  3. 返回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"
    }

交易接口

  • 测试环境地址
http://pre.sovell.com/sovellpay/v2
  • 生产环境地址
http://pass.sovell.com/sovellpay/v2
  1. 在http请求头中设置OAuth2授权返回的access_token

    Authorization: Bearer ${access_token}

  2. 详见 交易接口

Clone repository
  • Home
  • 接口
    • 交易
    • 消息
    • 用户
    • 通用券
  • 渠道
    • 微信 1基本参数
    • 微信 2商户平台配置
    • 微信 3公众号参数
    • 微信 4公众平台配置
    • 微信(服务商方式)
    • 支付宝 1基本参数
    • 支付宝 2公钥上传
    • 支付宝(服务商方式)