This commit is contained in:
2025-09-29 17:57:45 +03:00
parent 9b284852e9
commit 1e9a6a07c1
3 changed files with 15 additions and 15 deletions

View File

@@ -252,10 +252,10 @@ REDIS_URL=redis://localhost:6379/0
### Быстрая проверка
```bash
# Проверка OAuth провайдеров
curl https://your-domain.com/oauth/google
curl https://v3.discours.io/oauth/google
# Проверка сессии
curl -b "session_token=your_token" https://your-domain.com/graphql \
curl -b "session_token=your_token" https://v3.discours.io/graphql \
-d '{"query":"query { getSession { success author { id } } }"}'
```

View File

@@ -207,7 +207,7 @@ export const AuthProvider = (props: { children: JSX.Element }) => {
### Google OAuth
1. [Google Cloud Console](https://console.cloud.google.com/)
2. **APIs & Services****Credentials****OAuth 2.0 Client ID**
3. **Authorized redirect URIs**: `https://your-domain.com/oauth/google/callback`
3. **Authorized redirect URIs**: `https://v3.discours.io/oauth/google/callback`
```bash
GOOGLE_CLIENT_ID=your_google_client_id
@@ -217,7 +217,7 @@ GOOGLE_CLIENT_SECRET=your_google_client_secret
### GitHub OAuth
1. [GitHub Developer Settings](https://github.com/settings/developers)
2. **New OAuth App**
3. **Authorization callback URL**: `https://your-domain.com/oauth/github/callback`
3. **Authorization callback URL**: `https://v3.discours.io/oauth/github/callback`
```bash
GITHUB_CLIENT_ID=your_github_client_id
@@ -227,7 +227,7 @@ GITHUB_CLIENT_SECRET=your_github_client_secret
### Yandex OAuth
1. [Yandex OAuth](https://oauth.yandex.ru/)
2. **Создать новое приложение**
3. **Callback URI**: `https://your-domain.com/oauth/yandex/callback`
3. **Callback URI**: `https://v3.discours.io/oauth/yandex/callback`
4. **Права**: `login:info`, `login:email`, `login:avatar`
```bash
@@ -238,7 +238,7 @@ YANDEX_CLIENT_SECRET=your_yandex_client_secret
### VK OAuth
1. [VK Developers](https://dev.vk.com/apps)
2. **Создать приложение****Веб-сайт**
3. **Redirect URI**: `https://your-domain.com/oauth/vk/callback`
3. **Redirect URI**: `https://v3.discours.io/oauth/vk/callback`
```bash
VK_CLIENT_ID=your_vk_app_id
@@ -333,13 +333,13 @@ test('OAuth flow with httpOnly cookies', async ({ page }) => {
### Отладка
```bash
# Проверка OAuth провайдеров
curl -v "https://your-domain.com/oauth/google/login"
curl -v "https://v3.discours.io/oauth/google/login"
# Проверка callback
curl -v "https://your-domain.com/oauth/google/callback?code=test&state=test"
curl -v "https://v3.discours.io/oauth/google/callback?code=test&state=test"
# Проверка сессии с cookie
curl -b "session_token=your_token" "https://your-domain.com/graphql" \
curl -b "session_token=your_token" "https://v3.discours.io/graphql" \
-d '{"query":"query { getSession { success author { id } } }"}'
```

View File

@@ -44,24 +44,24 @@ LOCKOUT_DURATION=1800 # 30 минут
1. [Google Cloud Console](https://console.cloud.google.com/)
2. **APIs & Services****Credentials****Create OAuth 2.0 Client ID**
3. **Authorized redirect URIs**:
- `https://your-domain.com/oauth/google/callback` (продакшн)
- `https://v3.discours.io/oauth/google/callback` (продакшн)
- `http://localhost:8000/oauth/google/callback` (разработка)
#### GitHub OAuth
1. [GitHub Developer Settings](https://github.com/settings/developers)
2. **New OAuth App**
3. **Authorization callback URL**: `https://your-domain.com/oauth/github/callback`
3. **Authorization callback URL**: `https://v3.discours.io/oauth/github/callback`
#### Yandex OAuth
1. [Yandex OAuth](https://oauth.yandex.ru/)
2. **Создать новое приложение**
3. **Callback URI**: `https://your-domain.com/oauth/yandex/callback`
3. **Callback URI**: `https://v3.discours.io/oauth/yandex/callback`
4. **Права**: `login:info`, `login:email`, `login:avatar`
#### VK OAuth
1. [VK Developers](https://dev.vk.com/apps)
2. **Создать приложение****Веб-сайт**
3. **Redirect URI**: `https://your-domain.com/oauth/vk/callback`
3. **Redirect URI**: `https://v3.discours.io/oauth/vk/callback`
### 3. Проверка настройки
@@ -83,7 +83,7 @@ async def test():
asyncio.run(test())"
# Проверка OAuth провайдеров
curl -v "https://your-domain.com/oauth/google/login"
curl -v "https://v3.discours.io/oauth/google/login"
```
## 🔒 Безопасность в продакшене
@@ -131,7 +131,7 @@ echo $GOOGLE_CLIENT_SECRET
#### "Cookies не работают"
```bash
# Проверить настройки cookie
curl -v -b "session_token=test" "https://your-domain.com/graphql"
curl -v -b "session_token=test" "https://v3.discours.io/graphql"
# Проверить что фронтенд отправляет credentials
# В коде должно быть: credentials: 'include'