Postman 接口集分享


获取 access_token 对应的用户信息

请求参数合法,系统返回

  • 状态码 200
  • JSON 数据(不带用户信息)
  1. {
  2. "user_attribute": {},
  3. "grant_type": "client_credentials",
  4. "iat": 1451602800,
  5. "exp": 1451606400,
  6. "client_id": "test_client_id_1"
  7. }
  • JSON 数据(带用户信息)
  1. {
  2. "user_attribute": {
  3. "email": "gitnavi@youmeek.com",
  4. "user_id": "7172",
  5. "username": "张三"
  6. },
  7. "grant_type": "authorization_code",
  8. "iat": 1451602800,
  9. "exp": 1451606400,
  10. "client_id": "test_client_id_1"
  11. }

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

  • 状态码 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. }

登出

请求参数合法,系统返回

  • 状态码 302
  • Location
  1. http://test1.cdk8s.com:9393/client-scribejava

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

  • 停留在登录页面或跳转到 error 页面

通过 refresh_token,获取新的 access_token

  1. grant_type: refresh_token
  2. refresh_token: RT-8aI3zHbArcmzT3ukHlBQ88AdMv2NB8Aa-103
  3. client_id: test_client_id_1
  4. client_secret: test_client_secret_1

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=refresh_token&refresh_token=RT-8aI3zHbArcmzT3ukHlBQ88AdMv2NB8Aa-103&client_id=test_client_id_1&client_secret=test_client_secret_1'

请求参数合法,系统返回

  • 状态码 200
  • JSON 数据
  1. {
  2. "access_token": "AT-IDm312Our5Jti70BGE8RgO2qRK29blri",
  3. "token_type": "Bearer",
  4. "expires_in": 57600
  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. }

验证 access_token / refresh_token

  1. client_id: test_client_id_1
  2. client_secret: test_client_secret_1
  3. token: AT-3KGHVaANf4Ppi1IhrlHTF9IKSsV7fuzY-109
  4. token_type_hint: access_token
  • token_type_hint,可选值
    • access_token
    • refresh_token

请求参数合法,系统返回

  • 状态码 200
  • JSON 数据
  1. {
  2. "token_type": "Bearer",
  3. "grant_type": "client_credentials",
  4. "client_id": "test_client_id_1",
  5. "exp": 1561438626,
  6. "iat": 1561381026
  7. }
请求参数不合法,系统返回
  • 状态码 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. }