CredentialBroker / Client / start_o_auth_session
start_o_auth_session¶
- CredentialBroker.Client.start_o_auth_session(**kwargs)¶
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
CompleteOAuthSessionBindingwithSESSION_STATE_CONFLICT.See also: AWS API Documentation
Request Syntax
response = client.start_o_auth_session( credentialProviderArn='string', scopes=[ 'string', ], sessionBindingUrl='string', resources=[ 'string', ], audiences=[ 'string', ], customParameters={ 'string': 'string' }, customState='string' )
- Parameters:
credentialProviderArn (string) –
[REQUIRED]
Amazon Resource Name of the credential provider the user is granting consent for.
scopes (list) –
The OAuth scopes to request from the authorization server.
(string) –
sessionBindingUrl (string) –
[REQUIRED]
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 (list) –
Resource indicators (RFC 8707) naming the APIs this token is for. Omit unless the authorization server requires them.
(string) –
audiences (list) –
Audience values (RFC 8693) naming the intended recipients of this token. Omit unless the authorization server requires them.
(string) –
customParameters (dict) –
Extra parameters to include in the request to the authorization server, for vendor extensions. Added to the standard OAuth parameters; they never override them.
(string) –
(string) –
customState (string) – 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.
- Return type:
dict
- Returns:
Response Syntax
{ 'authorizationUrl': 'string', 'sessionUri': 'string', 'sessionStatus': 'IN_PROGRESS'|'COMPLETED'|'FAILED', 'accessToken': 'string', 'expiresAt': datetime(2015, 1, 1) }
Response Structure
(dict) –
authorizationUrl (string) –
The URL to send the end user’s browser to so they can grant consent. Present only when consent is required; absent when a token was available and is returned instead.
sessionUri (string) –
Opaque handle to the pending consent session. Present only when interactive consent is required (absent when accessToken is returned).
sessionStatus (string) –
Status of the session (IN_PROGRESS when consent is required).
accessToken (string) –
Present only when a valid token already existed (no consent needed).
expiresAt (datetime) –
Expiry of accessToken when returned.
Exceptions