From fdabd468fbbfbacc55ac941a954b62e54c8c281f Mon Sep 17 00:00:00 2001
From: syui <syui@noreply.git.syui.ai>
Date: Tue, 17 Jun 2025 04:03:59 +0000
Subject: [PATCH] =?UTF-8?q?oauth=20=E3=82=92=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 oauth.md | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/oauth.md b/oauth.md
index de7c010..ba68a8f 100644
--- a/oauth.md
+++ b/oauth.md
@@ -17,6 +17,16 @@ PDS_SERVICE_DID=did:web:syu.is
 PDS_PUBLIC_URL=https://syu.is
 ```
 
+```js
+      this.oauthClient = await BrowserOAuthClient.load({
+        clientId: this.getClientId(),
+        handleResolver: pdsUrl,
+        plcDirectoryUrl: pdsUrl === 'https://syu.is' ? 'https://plc.syu.is' : 'https://plc.directory',
+      });
+```
+
+## 解説
+
 [@atproto/oauth-provider](https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-provider)が本体となる。
 
 > https://syu.is/@atproto/oauth-provider/~assets/file.css
@@ -26,9 +36,11 @@ curl -s https://syu.is/.well-known/oauth-authorization-server |jq .
 curl -s "https://syu.is/oauth/authorize?client_id=https://syui.ai/client-metadata.json&response_type=code&redirect_uri=https://syui.ai/oauth/callback"
 ```
 
-## 裏でblueskyのserverを使って名前解決している
+### 裏でblueskyのserverを使って名前解決している
 
-現在のatproto-oauthは裏でblueskyのserverを使います。ですから、例えば、plc.directoryに登録されていないと成功しません。
+これは、自分のplcを使うようにすれば解決できます。
+
+atproto-oauthは裏でblueskyのserverを使います。ですから、例えば、plc.directoryに登録されていないと成功しません。
 
 ```sh
 # handle changeを行ったあとに更新されずdidでしかoauthできない。異なる名前で登録されている例
@@ -46,7 +58,7 @@ $ curl -sL "https://plc.directory/did:plc:6qyecktefllvenje24fcxnie" | jq '.alsoK
 ]
 ```
 
-## didのhandleを確認
+### didのhandleを確認
 
 ```sh
 did=did:plc:6qyecktefllvenje24fcxnie