ccproxy.auth.oauth.router¶
ccproxy.auth.oauth.router
¶
Central OAuth router that delegates to plugin providers.
This module provides unified OAuth endpoints that dynamically route to the appropriate plugin-based OAuth provider.
list_oauth_providers
async
¶
List all available OAuth providers.
Returns:
| Type | Description |
|---|---|
OAuthProvidersResponse
|
Dictionary of available OAuth providers with their information |
Source code in ccproxy/auth/oauth/router.py
initiate_oauth_login
async
¶
initiate_oauth_login(
request,
provider,
redirect_uri=Query(
None, description="Optional redirect URI override"
),
scopes=Query(
None,
description="Optional scope override (comma-separated)",
),
)
Initiate OAuth login flow for a specific provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider name (e.g., 'claude-api', 'codex') |
required |
redirect_uri
|
str | None
|
Optional redirect URI override |
Query(None, description='Optional redirect URI override')
|
scopes
|
str | None
|
Optional scope override |
Query(None, description='Optional scope override (comma-separated)')
|
Returns:
| Type | Description |
|---|---|
RedirectResponse
|
Redirect to provider's authorization URL |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If provider not found or error generating auth URL |
Source code in ccproxy/auth/oauth/router.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
handle_oauth_callback
async
¶
handle_oauth_callback(
provider,
request,
code=Query(None, description="Authorization code"),
state=Query(None, description="OAuth state"),
error=Query(None, description="OAuth error"),
error_description=Query(
None, description="Error description"
),
)
Handle OAuth callback from provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider name |
required |
request
|
Request
|
FastAPI request |
required |
code
|
str | None
|
Authorization code from provider |
Query(None, description='Authorization code')
|
state
|
str | None
|
OAuth state for validation |
Query(None, description='OAuth state')
|
error
|
str | None
|
OAuth error code |
Query(None, description='OAuth error')
|
error_description
|
str | None
|
OAuth error description |
Query(None, description='Error description')
|
Returns:
| Type | Description |
|---|---|
HTMLResponse
|
HTML response with success or error message |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If provider not found or callback handling fails |
Source code in ccproxy/auth/oauth/router.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
refresh_oauth_token
async
¶
Refresh OAuth access token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider name |
required |
refresh_token
|
str
|
Refresh token |
required |
Returns:
| Type | Description |
|---|---|
JSONResponse
|
New token response |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If provider not found or refresh fails |
Source code in ccproxy/auth/oauth/router.py
revoke_oauth_token
async
¶
Revoke an OAuth token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Provider name |
required |
token
|
str
|
Token to revoke |
required |
Returns:
| Type | Description |
|---|---|
Response
|
Empty response on success |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If provider not found or revocation fails |