Postman 接口集分享

密码模式

  1. grant_type: password
  2. client_id: test_client_id_1
  3. client_secret: test_client_secret_1
  4. username: admin
  5. password: 123456
  • 也支持请求头验证 client:Authorization: Basic dGVzdF9jbGllbnRfaWRfMTp0ZXN0X2NsaWVudF9zZWNyZXRfMQ==

cURL

  1. curl -X POST \
  2. http://sso.cdk8s.com:9091/sso/oauth/token \
  3. -H 'Content-Type: application/x-www-form-urlencoded' \
  4. -H 'cache-control: no-cache' \
  5. -d 'grant_type=password&client_id=test_client_id_1&client_secret=test_client_secret_1&username=admin&password=123456'

请求参数合法,系统返回

  • 状态码 200
  • JSON 数据
  1. {
  2. "access_token": "AT-MISqrbWUxFWc1xU4e8JK2OcMgJYusF22-101",
  3. "token_type": "Bearer",
  4. "expires_in": 57600,
  5. "refresh_token": "RT-7UPY41g9j5K8rKBZse4qo4iP6sAbU2Df-102"
  6. }

请求参数不合法,系统返回

  • 状态码 400
  • JSON 数据
  1. {
  2. "error": "invalid request",
  3. "error_description": "请求类型不匹配",
  4. "error_uri_msg": "See the full API docs at https://github.com/cdk8s"
  5. }

用户名密码有问题,系统返回

  • 状态码 400
  • JSON 数据
  1. {
  2. "error": "invalid request",
  3. "error_description": "用户名或密码错误",
  4. "error_uri_msg": "See the full API docs at https://github.com/cdk8s"
  5. }