
登录中心https://jingweihub.com
我的应用
登录后登记应用名称与 HTTPS 回调地址。 / 服务端应用的 client_secret 仅显示一次。
快速接入
登记应用
在登录后登记你的应用,保存分配的 client_id 与 HTTPS 回调地址。
发起授权
使用授权码模式(Authorization Code)并结合 PKCE 发起用户授权。
交换令牌
在用户授权后,使用获取到的 code 与 code_verifier 向令牌端点换取令牌。
建立会话
使用访问令牌获取用户信息,建立应用会话,并按需处理令牌撤销。
常用端点
- GET
/api/public/oauth/authorize- POST
/api/public/oauth/token- GET
/api/public/oauth/userinfo- POST
/api/public/oauth/revoke- GET
/api/public/oauth/jwks
授权参数
GET https://jingweihub.com/api/public/oauth/authorize
response_typecodeclient_id- 登记应用时分配的客户端编号。
redirect_uri- 必须与登记的 HTTPS 回调地址完全一致。
scopeopenid email— openid 必填;email 为可选授权范围。state / nonce- 为本次授权生成随机值,并在回调及 ID Token 中校验对应值。
code_challengeBASE64URL(SHA256(code_verifier))code_challenge_methodS256
换取与刷新令牌
POST https://jingweihub.com/api/public/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=...&redirect_uri=...&client_id=...&code_verifier=...服务端应用还需提交 client_secret;公开应用不传 client_secret。刷新时使用 grant_type=refresh_token,并提交 refresh_token 及客户端参数。
ID Token 使用 RS256 签名。校验签名、iss、aud、exp 和本次授权的 nonce;iss 是本页登录中心,aud 是 client_id。
用户信息与撤销
GET https://jingweihub.com/api/public/oauth/userinfo
Authorization: Bearer <access_token>
返回 sub、username、preferred_username、name。仅在授权 email 范围且账号已绑定邮箱时返回邮箱相关信息;不会返回密码。
POST https://jingweihub.com/api/public/oauth/revoke
使用表单提交 token、client_id;服务端应用还需 client_secret。退出应用时撤销令牌,并清理应用自身的会话。