- pig获取token
- pig-学习-oauth2逻辑
- pig-学习-cloud
- feign学习
- 用户模块
- 注册登录
- 部门管理
- 菜单管理
- 角色管理
- 字典管理
v1.0+ 密码模式获取token
开发中
POST
http://127.0.0.1:8080/oauth2/token
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Basic 之后拼接空格,以及经过 Base64 编码的 username:password
示例:
Authorization: Basic *****************
Query 参数
grant_type
string
必需
示例值:
password
scope
string
必需
示例值:
server
client_id
string
可选
示例值:
umps
response_type
string
可选
示例值:
code
redirect_uri
string
可选
示例值:
https://pig4cloud.com
Body 参数application/x-www-form-urlencoded
username
string
必需
示例值:
qc
password
string
必需
示例值:
123
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://127.0.0.1:8080/oauth2/token?grant_type=password&scope=server' \
--header 'Authorization: Basic Og==' \
--data-urlencode 'username=qc' \
--data-urlencode 'password=123'
返回响应
🟢200成功
application/json
Body
object {0}
示例
{
"sub": "qc",
"clientId": "qingchen",
"iss": "https://pig4cloud.com",
"token_type": "Bearer",
"access_token": "qingchen::qc::92194b38-44e0-45ca-b88e-f9c3d65f0261",
"refresh_token": "xK9-079o3ZHOtnES49hbMnrf-PlJ-i_e3IPyR-JQoRLrkJL63soHPjun5rG4Or2GMTYL1TAYFxF5xtB9647vaSNEFv5BOC4KYjwrew3_Z3qkS0bNhq2t3VhUmNasu78V",
"aud": [
"qingchen"
],
"license": "https://pig4cloud.com",
"nbf": 1663999979.518,
"user_info": {
"password": null,
"username": "qc",
"authorities": [
{
"authority": "ROLE_select"
}
],
"accountNonExpired": true,
"accountNonLocked": true,
"credentialsNonExpired": true,
"enabled": true
},
"scope": [
"server"
],
"exp": 1664003579.518,
"expires_in": 3600,
"iat": 1663999979.518,
"jti": "2c536bc4-a7cc-4479-b045-0122dc390a5c"
}
修改于 2022-10-08 06:50:40