Buckets:
| """Google OAuth2 flow using authlib.""" | |
| from authlib.integrations.starlette_client import OAuth | |
| from yaai.server.auth.config import AuthConfig | |
| _oauth: OAuth | None = None | |
| def setup_oauth(config: AuthConfig) -> OAuth | None: | |
| """Initialize the OAuth client with Google provider if enabled.""" | |
| global _oauth # noqa: PLW0603 | |
| if not config.oauth.google.enabled: | |
| return None | |
| _oauth = OAuth() | |
| _oauth.register( | |
| name="google", | |
| client_id=config.oauth.google.client_id.get_secret_value(), | |
| client_secret=config.oauth.google.client_secret.get_secret_value(), | |
| server_metadata_url="https://accounts.google.com/.well-known/openid-configuration", | |
| client_kwargs={"scope": "openid email profile"}, | |
| ) | |
| return _oauth | |
| def get_oauth() -> OAuth | None: | |
| """Get the initialized OAuth client.""" | |
| return _oauth | |
Xet Storage Details
- Size:
- 876 Bytes
- Xet hash:
- 008729f555ec0228f2dd1f58049ce24adb853015241e13fe5421fb44cc01c8ba
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.