start_o_auth_session
async
¶
start_o_auth_session(
credential_provider_arn: CredentialProviderArn,
session_binding_url: SessionBindingUrl,
*,
config_overrides: Optional[AsyncCredentialBrokerClientConfig] = None,
scopes: Optional[Scopes] = None,
resources: Optional[Resources] = None,
audiences: Optional[Audiences] = None,
custom_parameters: Optional[CustomParameters] = None,
custom_state: Optional[CustomState] = None,
) -> StartOAuthSessionResponse
Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf. Returns a URL to send the user's browser to, and a handle identifying the session.
Call this when GetOAuthToken returns no token for a provider that requires user consent. When a valid token is already available, this returns it directly and no consent is needed.
The operation is not idempotent and takes no idempotency token: it is an OAuth consent-flow step rather than durable resource creation. A replayed session is rejected by CompleteOAuthSessionBinding with SESSION_STATE_CONFLICT.
Parameters:
-
credential_provider_arn(CredentialProviderArn) –Amazon Resource Name of the credential provider the user is granting consent for.
-
scopes(Optional[Scopes], default:None) –The OAuth scopes to request from the authorization server.
-
session_binding_url(SessionBindingUrl) –The URL the end user's browser is returned to once they have responded to the consent prompt. Must match one of the session-binding URLs allowed on the provider.
-
resources(Optional[Resources], default:None) –Resource indicators (RFC 8707) naming the APIs this token is for. Omit unless the authorization server requires them.
-
audiences(Optional[Audiences], default:None) –Audience values (RFC 8693) naming the intended recipients of this token. Omit unless the authorization server requires them.
-
custom_parameters(Optional[CustomParameters], default:None) –Extra parameters to include in the request to the authorization server, for vendor extensions. Added to the standard OAuth parameters; they never override them.
-
custom_state(Optional[CustomState], default:None) –An opaque string of your own that is sent back to your session-binding URL unchanged. Use it to tie the response to the request you issued, so your handler can reject a response it did not initiate.
Raises:
-
AccessDeniedException–The caller is not authorized to perform the request, or a resource the request depends on refused access.
reasondistinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API. -
InternalServerException–The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
-
ResourceNotFoundException–The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
-
ServiceUnavailableException–A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx,
server_error, ortemporarily_unavailable). Retryable: the same request may succeed later. -
ThrottlingException–The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring
retryAfterSecondswhen it is present. -
ValidationException–The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use
reasonto branch in code andmessagefor the human-readable detail of which field or combination of fields was at fault. -
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_credentialbroker/_services/async_credential_broker.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |