雫の账号中心
auth.shizuku.plus
返回

接口一览

1. 授权(PKCE,推荐)

GET  /oauth/authorize?client_id=nekootp&response_type=code
     &redirect_uri=nekootp://auth&state=xxx
     &code_challenge=BASE64URL(SHA256(verifier))&code_challenge_method=S256
→ 同意后 302: nekootp://auth?code=CODE&state=xxx

POST /oauth/token   (application/x-www-form-urlencoded)
     grant_type=authorization_code&code=CODE&client_id=nekootp
     &redirect_uri=nekootp://auth&code_verifier=VERIFIER
→ {access_token, token_type, expires_in, scope, user}

2. 授权(直接下发 token)

GET /oauth/authorize?...&response_type=token
→ 302: nekootp://auth?token=ACCESS_TOKEN&state=xxx

3. 接口

GET /api/me      Authorization: Bearer TOKEN
GET /api/vault   读取云备份
PUT /api/vault   {data:{...},version:1} 写入云备份(内容由客户端加密)
POST /oauth/revoke {token}  吊销

4. 客户端

client_id: nekootp
redirect_uri: nekootp://auth , nekootp://auth/callback
类型: public(无 secret,强制 PKCE)

5. 接入自己的应用

POST https://auth.shizuku.plus/api/clients
  X-Admin-Key: <admin_key>        或  Authorization: Bearer <token>
  {"name":"念念的博客",
   "redirect_uris":["https://blog.example.com/auth/callback"],
   "homepage":"https://blog.example.com",
   "description":"个人博客"}

→ {"ok":true,"client":{"client_id":"nko_...","client_secret":"nks_...","deeplink_scheme":""}}

回调地址写成 myapp://auth 这种私有协议,就是 App 的登录回跳入口;返回里的 deeplink_scheme 会告诉你 scheme。

GET    /api/clients                   列出已申请的应用
GET    /api/clients/{id}?reveal=1     查看(含 secret)
PUT    /api/clients/{id}              改名字 / 回调
DELETE /api/clients/{id}              删除

6. 账号资料

PUT  /api/profile   {"display_name":"念念"}        改昵称
POST /api/avatar    {"data":"<base64 JPEG>"}      改头像(≤3MB)
GET  /u/{username}                                 个人主页