From 4dd50c493795406a569a20d092a92bf396499c1b Mon Sep 17 00:00:00 2001 From: syui Date: Fri, 27 Mar 2026 04:40:11 +0900 Subject: [PATCH] oauth file name --- ...nt-metadata.json => oauth-client-metadata.json} | 2 +- readme.md | 14 +++++++------- src/commands/oauth.rs | 4 ++-- src/web/lib/auth.ts | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) rename public/{client-metadata.json => oauth-client-metadata.json} (86%) diff --git a/public/client-metadata.json b/public/oauth-client-metadata.json similarity index 86% rename from public/client-metadata.json rename to public/oauth-client-metadata.json index 444e6cd..826f323 100644 --- a/public/client-metadata.json +++ b/public/oauth-client-metadata.json @@ -1,5 +1,5 @@ { - "client_id": "https://syui.ai/client-metadata.json", + "client_id": "https://syui.ai/oauth-client-metadata.json", "client_name": "syui.ai", "client_uri": "https://syui.ai", "redirect_uris": ["https://syui.ai/oauth/callback", "https://syui.ai/oauth/cli"], diff --git a/readme.md b/readme.md index cc2eff9..5be17a1 100644 --- a/readme.md +++ b/readme.md @@ -44,13 +44,13 @@ Use ATProto OAuth to login from the browser and create, edit, or delete posts. ### Setup -#### 1. Edit client-metadata.json +#### 1. Edit oauth-client-metadata.json -Modify `public/client-metadata.json` with your own domain: +Modify `public/oauth-client-metadata.json` with your own domain: ```json { - "client_id": "https://example.com/client-metadata.json", + "client_id": "https://example.com/oauth-client-metadata.json", "client_name": "example.com", "client_uri": "https://example.com", "redirect_uris": ["https://example.com/"], @@ -67,17 +67,17 @@ Modify `public/client-metadata.json` with your own domain: | Field | Description | |-------|-------------| -| `client_id` | URL of this file. Must be `https://yourdomain.com/client-metadata.json` | +| `client_id` | URL of this file. Must be `https://yourdomain.com/oauth-client-metadata.json` | | `client_name` | App name (shown on auth screen) | | `client_uri` | Your site URL | | `redirect_uris` | Redirect URL after OAuth. Use your site's root URL | #### 2. Deploy the file -`client-metadata.json` must be publicly accessible at: +`oauth-client-metadata.json` must be publicly accessible at: ``` -https://yourdomain.com/client-metadata.json +https://yourdomain.com/oauth-client-metadata.json ``` The ATProto PDS fetches this file during authentication, so it **must be accessible via public URL**. @@ -114,7 +114,7 @@ The appropriate PDS is automatically selected based on the handle's domain. - **Auth error**: Verify `client_id` matches the actual file URL - **Redirect error**: Verify `redirect_uris` matches your site URL -- **CORS error**: Verify `client-metadata.json` is served with correct Content-Type +- **CORS error**: Verify `oauth-client-metadata.json` is served with correct Content-Type ## cli diff --git a/src/commands/oauth.rs b/src/commands/oauth.rs index 30b5557..1592d60 100644 --- a/src/commands/oauth.rs +++ b/src/commands/oauth.rs @@ -485,7 +485,7 @@ pub async fn refresh_oauth_session(is_bot: bool) -> Result<(OAuthSession, Sessio ]; let site_url = load_site_url()?; - let client_id_url = format!("{}/client-metadata.json", site_url); + let client_id_url = format!("{}/oauth-client-metadata.json", site_url); let form_params = [ ("grant_type", "refresh_token"), @@ -666,7 +666,7 @@ pub async fn oauth_login(handle: &str, is_bot: bool) -> Result<()> { // 5. Client metadata (derived from config.json siteUrl) let site_url = load_site_url()?; - let client_id = format!("{}/client-metadata.json", site_url); + let client_id = format!("{}/oauth-client-metadata.json", site_url); let scope = "atproto transition:generic transition:chat.bsky"; // Try /oauth/cli first, fallback to /oauth/callback diff --git a/src/web/lib/auth.ts b/src/web/lib/auth.ts index 1479857..cb71e94 100644 --- a/src/web/lib/auth.ts +++ b/src/web/lib/auth.ts @@ -18,7 +18,7 @@ function getClientId(): string { return `http://localhost?redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent('atproto transition:generic')}` } - return `${window.location.origin}/client-metadata.json` + return `${window.location.origin}/oauth-client-metadata.json` } // Set network config (call before login)