oauth file name
This commit is contained in:
@@ -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"],
|
||||
14
readme.md
14
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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user