2
0

oauth file name

This commit is contained in:
2026-03-27 04:40:11 +09:00
parent 1d8224c4bf
commit 4dd50c4937
4 changed files with 11 additions and 11 deletions

View File

@@ -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_name": "syui.ai",
"client_uri": "https://syui.ai", "client_uri": "https://syui.ai",
"redirect_uris": ["https://syui.ai/oauth/callback", "https://syui.ai/oauth/cli"], "redirect_uris": ["https://syui.ai/oauth/callback", "https://syui.ai/oauth/cli"],

View File

@@ -44,13 +44,13 @@ Use ATProto OAuth to login from the browser and create, edit, or delete posts.
### Setup ### 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 ```json
{ {
"client_id": "https://example.com/client-metadata.json", "client_id": "https://example.com/oauth-client-metadata.json",
"client_name": "example.com", "client_name": "example.com",
"client_uri": "https://example.com", "client_uri": "https://example.com",
"redirect_uris": ["https://example.com/"], "redirect_uris": ["https://example.com/"],
@@ -67,17 +67,17 @@ Modify `public/client-metadata.json` with your own domain:
| Field | Description | | 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_name` | App name (shown on auth screen) |
| `client_uri` | Your site URL | | `client_uri` | Your site URL |
| `redirect_uris` | Redirect URL after OAuth. Use your site's root URL | | `redirect_uris` | Redirect URL after OAuth. Use your site's root URL |
#### 2. Deploy the file #### 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**. 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 - **Auth error**: Verify `client_id` matches the actual file URL
- **Redirect error**: Verify `redirect_uris` matches your site 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 ## cli

View File

@@ -485,7 +485,7 @@ pub async fn refresh_oauth_session(is_bot: bool) -> Result<(OAuthSession, Sessio
]; ];
let site_url = load_site_url()?; 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 = [ let form_params = [
("grant_type", "refresh_token"), ("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) // 5. Client metadata (derived from config.json siteUrl)
let site_url = load_site_url()?; 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"; let scope = "atproto transition:generic transition:chat.bsky";
// Try /oauth/cli first, fallback to /oauth/callback // Try /oauth/cli first, fallback to /oauth/callback

View File

@@ -18,7 +18,7 @@ function getClientId(): string {
return `http://localhost?redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent('atproto transition:generic')}` 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) // Set network config (call before login)