Get Social Accounts
Get all connected social accounts for the authenticated user.
Quick Navigation
Endpoint
GET /api/v1/auth/social-accounts
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Response
Success (200)
{
"success": true,
"data": {
"accounts": [
{
"provider": "github",
"connected_at": "2024-01-01T10:00:00Z",
"last_used_at": "2024-01-01T12:00:00Z",
"email": "user@github.com",
"display_name": "GitHub User"
},
{
"provider": "google",
"connected_at": "2024-01-01T11:00:00Z",
"last_used_at": "2024-01-01T11:30:00Z",
"email": "user@gmail.com",
"display_name": "Google User"
}
],
"total": 2
},
"message": "Connected social accounts retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing token |
| 500 | ACCOUNTS_FETCH_FAILED | Failed to retrieve accounts |
Data Flow
-
Authentication
- Verify access token
- Get current user
-
SSO Session Query
- Query SsoSession table
- Filter by user ID
- Join with AuthProvider to get provider type
-
Account Assembly
- Get provider information
- Get session timestamps
- Extract account details from session metadata
-
Response Formatting
- Format timestamps as ISO strings
- Group by provider
- Include connection and usage data
-
Response
- Return list of connected accounts
- Include total count
Features
- Lists all connected social accounts
- Shows provider type (GitHub, Google, Apple, Microsoft)
- Displays connection date and last used timestamp
- Includes account email and display name from provider
- Returns total count
Example
curl -X GET https://api.rivergen.com/api/v1/auth/social-accounts \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- Get Current User - View security summary including social accounts
- Social Login - Connect new social account