35 lines
No EOL
1 KiB
Python
35 lines
No EOL
1 KiB
Python
"""
|
|
Models for Google authentication and API operations.
|
|
"""
|
|
|
|
from pydantic import BaseModel, Field
|
|
from typing import Optional, Dict, Any
|
|
from datetime import datetime
|
|
|
|
class GoogleToken(BaseModel):
|
|
"""Model for Google OAuth tokens"""
|
|
access_token: str
|
|
refresh_token: Optional[str] = None
|
|
expires_in: int
|
|
token_type: str = "bearer"
|
|
expires_at: float
|
|
user_info: Dict[str, Any]
|
|
mandateId: str
|
|
userId: str
|
|
|
|
class GoogleUserInfo(BaseModel):
|
|
"""Model for Google user information"""
|
|
id: str # Google uses 'sub' as the unique identifier
|
|
email: str
|
|
name: str
|
|
picture: Optional[str] = None # Google provides profile picture URL
|
|
|
|
class GoogleConfig(BaseModel):
|
|
"""Configuration for Google authentication service"""
|
|
client_id: str
|
|
client_secret: str
|
|
redirect_uri: str
|
|
scopes: list[str]
|
|
authority_url: str = "https://accounts.google.com"
|
|
token_url: str = "https://oauth2.googleapis.com/token"
|
|
user_info_url: str = "https://www.googleapis.com/oauth2/v3/userinfo" |