SSOOIDC ******* Client ====== class SSOOIDC.Client A low-level client representing AWS SSO OIDC IAM Identity Center OpenID Connect (OIDC) is a web service that enables a client (such as CLI or a native application) to register with IAM Identity Center. The service also enables the client to fetch the user’s access token upon successful authentication and authorization with IAM Identity Center. **API namespaces** IAM Identity Center uses the "sso" and "identitystore" API namespaces. IAM Identity Center OpenID Connect uses the "sso-oidc" namespace. **Considerations for using this guide** Before you begin using this guide, we recommend that you first review the following important information about how the IAM Identity Center OIDC service works. * The IAM Identity Center OIDC service currently implements only the portions of the OAuth 2.0 Device Authorization Grant standard ( https://tools.ietf.org/html/rfc8628) that are necessary to enable single sign-on authentication with the CLI. * With older versions of the CLI, the service only emits OIDC access tokens, so to obtain a new token, users must explicitly re-authenticate. To access the OIDC flow that supports token refresh and doesn’t require re-authentication, update to the latest CLI version (1.27.10 for CLI V1 and 2.9.0 for CLI V2) with support for OIDC token refresh and configurable IAM Identity Center session durations. For more information, see Configure Amazon Web Services access portal session duration. * The access tokens provided by this service grant access to all Amazon Web Services account entitlements assigned to an IAM Identity Center user, not just a particular application. * The documentation in this guide does not describe the mechanism to convert the access token into Amazon Web Services Auth (“sigv4”) credentials for use with IAM-protected Amazon Web Services service endpoints. For more information, see GetRoleCredentials in the *IAM Identity Center Portal API Reference Guide*. For general information about IAM Identity Center, see What is IAM Identity Center? in the *IAM Identity Center User Guide*. import boto3 client = boto3.client('sso-oidc') These are the available methods: * can_paginate * close * create_token * create_token_with_iam * get_paginator * get_waiter * register_client * start_device_authorization SSOOIDC / Client / get_paginator get_paginator ************* SSOOIDC.Client.get_paginator(operation_name) Create a paginator for an operation. Parameters: **operation_name** (*string*) -- The operation name. This is the same name as the method name on the client. For example, if the method name is "create_foo", and you'd normally invoke the operation as "client.create_foo(**kwargs)", if the "create_foo" operation can be paginated, you can use the call "client.get_paginator("create_foo")". Raises: **OperationNotPageableError** -- Raised if the operation is not pageable. You can use the "client.can_paginate" method to check if an operation is pageable. Return type: "botocore.paginate.Paginator" Returns: A paginator object. SSOOIDC / Client / can_paginate can_paginate ************ SSOOIDC.Client.can_paginate(operation_name) Check if an operation can be paginated. Parameters: **operation_name** (*string*) -- The operation name. This is the same name as the method name on the client. For example, if the method name is "create_foo", and you'd normally invoke the operation as "client.create_foo(**kwargs)", if the "create_foo" operation can be paginated, you can use the call "client.get_paginator("create_foo")". Returns: "True" if the operation can be paginated, "False" otherwise. SSOOIDC / Client / start_device_authorization start_device_authorization ************************** SSOOIDC.Client.start_device_authorization(**kwargs) Initiates device authorization by requesting a pair of verification codes from the authorization service. See also: AWS API Documentation **Request Syntax** response = client.start_device_authorization( clientId='string', clientSecret='string', startUrl='string' ) Parameters: * **clientId** (*string*) -- **[REQUIRED]** The unique identifier string for the client that is registered with IAM Identity Center. This value should come from the persisted result of the RegisterClient API operation. * **clientSecret** (*string*) -- **[REQUIRED]** A secret string that is generated for the client. This value should come from the persisted result of the RegisterClient API operation. * **startUrl** (*string*) -- **[REQUIRED]** The URL for the Amazon Web Services access portal. For more information, see Using the Amazon Web Services access portal in the *IAM Identity Center User Guide*. Return type: dict Returns: **Response Syntax** { 'deviceCode': 'string', 'userCode': 'string', 'verificationUri': 'string', 'verificationUriComplete': 'string', 'expiresIn': 123, 'interval': 123 } **Response Structure** * *(dict) --* * **deviceCode** *(string) --* The short-lived code that is used by the device when polling for a session token. * **userCode** *(string) --* A one-time user verification code. This is needed to authorize an in-use device. * **verificationUri** *(string) --* The URI of the verification page that takes the "userCode" to authorize the device. * **verificationUriComplete** *(string) --* An alternate URL that the client can use to automatically launch a browser. This process skips the manual step in which the user visits the verification page and enters their code. * **expiresIn** *(integer) --* Indicates the number of seconds in which the verification code will become invalid. * **interval** *(integer) --* Indicates the number of seconds the client must wait between attempts when polling for a session. **Exceptions** * "SSOOIDC.Client.exceptions.InvalidRequestException" * "SSOOIDC.Client.exceptions.InvalidClientException" * "SSOOIDC.Client.exceptions.UnauthorizedClientException" * "SSOOIDC.Client.exceptions.SlowDownException" * "SSOOIDC.Client.exceptions.InternalServerException" SSOOIDC / Client / register_client register_client *************** SSOOIDC.Client.register_client(**kwargs) Registers a public client with IAM Identity Center. This allows clients to perform authorization using the authorization code grant with Proof Key for Code Exchange (PKCE) or the device code grant. See also: AWS API Documentation **Request Syntax** response = client.register_client( clientName='string', clientType='string', scopes=[ 'string', ], redirectUris=[ 'string', ], grantTypes=[ 'string', ], issuerUrl='string', entitledApplicationArn='string' ) Parameters: * **clientName** (*string*) -- **[REQUIRED]** The friendly name of the client. * **clientType** (*string*) -- **[REQUIRED]** The type of client. The service supports only "public" as a client type. Anything other than public will be rejected by the service. * **scopes** (*list*) -- The list of scopes that are defined by the client. Upon authorization, this list is used to restrict permissions when granting an access token. * *(string) --* * **redirectUris** (*list*) -- The list of redirect URI that are defined by the client. At completion of authorization, this list is used to restrict what locations the user agent can be redirected back to. * *(string) --* * **grantTypes** (*list*) -- The list of OAuth 2.0 grant types that are defined by the client. This list is used to restrict the token granting flows available to the client. Supports the following OAuth 2.0 grant types: Authorization Code, Device Code, and Refresh Token. * Authorization Code - "authorization_code" * Device Code - "urn:ietf:params:oauth:grant-type:device_code" * Refresh Token - "refresh_token" * *(string) --* * **issuerUrl** (*string*) -- The IAM Identity Center Issuer URL associated with an instance of IAM Identity Center. This value is needed for user access to resources through the client. * **entitledApplicationArn** (*string*) -- This IAM Identity Center application ARN is used to define administrator-managed configuration for public client access to resources. At authorization, the scopes, grants, and redirect URI available to this client will be restricted by this application resource. Return type: dict Returns: **Response Syntax** { 'clientId': 'string', 'clientSecret': 'string', 'clientIdIssuedAt': 123, 'clientSecretExpiresAt': 123, 'authorizationEndpoint': 'string', 'tokenEndpoint': 'string' } **Response Structure** * *(dict) --* * **clientId** *(string) --* The unique identifier string for each client. This client uses this identifier to get authenticated by the service in subsequent calls. * **clientSecret** *(string) --* A secret string generated for the client. The client will use this string to get authenticated by the service in subsequent calls. * **clientIdIssuedAt** *(integer) --* Indicates the time at which the "clientId" and "clientSecret" were issued. * **clientSecretExpiresAt** *(integer) --* Indicates the time at which the "clientId" and "clientSecret" will become invalid. * **authorizationEndpoint** *(string) --* An endpoint that the client can use to request authorization. * **tokenEndpoint** *(string) --* An endpoint that the client can use to create tokens. **Exceptions** * "SSOOIDC.Client.exceptions.InvalidRequestException" * "SSOOIDC.Client.exceptions.InvalidScopeException" * "SSOOIDC.Client.exceptions.InvalidClientMetadataException" * "SSOOIDC.Client.exceptions.InternalServerException" * "SSOOIDC.Client.exceptions.InvalidRedirectUriException" * "SSOOIDC.Client.exceptions.UnsupportedGrantTypeException" SSOOIDC / Client / get_waiter get_waiter ********** SSOOIDC.Client.get_waiter(waiter_name) Returns an object that can wait for some condition. Parameters: **waiter_name** (*str*) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. Returns: The specified waiter object. Return type: "botocore.waiter.Waiter" SSOOIDC / Client / create_token_with_iam create_token_with_iam ********************* SSOOIDC.Client.create_token_with_iam(**kwargs) Creates and returns access and refresh tokens for clients and applications that are authenticated using IAM entities. The access token can be used to fetch short-lived credentials for the assigned Amazon Web Services accounts or to access application APIs using "bearer" authentication. See also: AWS API Documentation **Request Syntax** response = client.create_token_with_iam( clientId='string', grantType='string', code='string', refreshToken='string', assertion='string', scope=[ 'string', ], redirectUri='string', subjectToken='string', subjectTokenType='string', requestedTokenType='string', codeVerifier='string' ) Parameters: * **clientId** (*string*) -- **[REQUIRED]** The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured. * **grantType** (*string*) -- **[REQUIRED]** Supports the following OAuth grant types: Authorization Code, Refresh Token, JWT Bearer, and Token Exchange. Specify one of the following values, depending on the grant type that you want: * Authorization Code - "authorization_code" * Refresh Token - "refresh_token" * JWT Bearer - "urn:ietf:params:oauth:grant-type:jwt-bearer" * Token Exchange - "urn:ietf:params:oauth:grant-type:token- exchange" * **code** (*string*) -- Used only when calling this API for the Authorization Code grant type. This short-lived code is used to identify this authorization request. The code is obtained through a redirect from IAM Identity Center to a redirect URI persisted in the Authorization Code GrantOptions for the application. * **refreshToken** (*string*) -- Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see *Considerations for Using this Guide* in the IAM Identity Center OIDC API Reference. * **assertion** (*string*) -- Used only when calling this API for the JWT Bearer grant type. This value specifies the JSON Web Token (JWT) issued by a trusted token issuer. To authorize a trusted token issuer, configure the JWT Bearer GrantOptions for the application. * **scope** (*list*) -- The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes that are granted. If the value is not specified, IAM Identity Center authorizes all scopes configured for the application, including the following default scopes: "openid", "aws", "sts:identity_context". * *(string) --* * **redirectUri** (*string*) -- Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code. * **subjectToken** (*string*) -- Used only when calling this API for the Token Exchange grant type. This value specifies the subject of the exchange. The value of the subject token must be an access token issued by IAM Identity Center to a different client or application. The access token must have authorized scopes that indicate the requested application as a target audience. * **subjectTokenType** (*string*) -- Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that is passed as the subject of the exchange. The following value is supported: * Access Token - "urn:ietf:params:oauth:token- type:access_token" * **requestedTokenType** (*string*) -- Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that the requester can receive. The following values are supported: * Access Token - "urn:ietf:params:oauth:token- type:access_token" * Refresh Token - "urn:ietf:params:oauth:token- type:refresh_token" * **codeVerifier** (*string*) -- Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time. Return type: dict Returns: **Response Syntax** { 'accessToken': 'string', 'tokenType': 'string', 'expiresIn': 123, 'refreshToken': 'string', 'idToken': 'string', 'issuedTokenType': 'string', 'scope': [ 'string', ], 'awsAdditionalDetails': { 'identityContext': 'string' } } **Response Structure** * *(dict) --* * **accessToken** *(string) --* A bearer token to access Amazon Web Services accounts and applications assigned to a user. * **tokenType** *(string) --* Used to notify the requester that the returned token is an access token. The supported token type is "Bearer". * **expiresIn** *(integer) --* Indicates the time in seconds when an access token will expire. * **refreshToken** *(string) --* A token that, if present, can be used to refresh a previously issued access token that might have expired. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see *Considerations for Using this Guide* in the IAM Identity Center OIDC API Reference. * **idToken** *(string) --* A JSON Web Token (JWT) that identifies the user associated with the issued access token. * **issuedTokenType** *(string) --* Indicates the type of tokens that are issued by IAM Identity Center. The following values are supported: * Access Token - "urn:ietf:params:oauth:token- type:access_token" * Refresh Token - "urn:ietf:params:oauth:token- type:refresh_token" * **scope** *(list) --* The list of scopes for which authorization is granted. The access token that is issued is limited to the scopes that are granted. * *(string) --* * **awsAdditionalDetails** *(dict) --* A structure containing information from the "idToken". Only the "identityContext" is in it, which is a value extracted from the "idToken". This provides direct access to identity information without requiring JWT parsing. * **identityContext** *(string) --* STS context assertion that carries a user identifier to the Amazon Web Services service that it calls and can be used to obtain an identity-enhanced IAM role session. This value corresponds to the "sts:identity_context" claim in the ID token. **Exceptions** * "SSOOIDC.Client.exceptions.InvalidRequestException" * "SSOOIDC.Client.exceptions.InvalidClientException" * "SSOOIDC.Client.exceptions.InvalidGrantException" * "SSOOIDC.Client.exceptions.UnauthorizedClientException" * "SSOOIDC.Client.exceptions.UnsupportedGrantTypeException" * "SSOOIDC.Client.exceptions.InvalidScopeException" * "SSOOIDC.Client.exceptions.AuthorizationPendingException" * "SSOOIDC.Client.exceptions.SlowDownException" * "SSOOIDC.Client.exceptions.AccessDeniedException" * "SSOOIDC.Client.exceptions.ExpiredTokenException" * "SSOOIDC.Client.exceptions.InternalServerException" * "SSOOIDC.Client.exceptions.InvalidRequestRegionException" SSOOIDC / Client / create_token create_token ************ SSOOIDC.Client.create_token(**kwargs) Creates and returns access and refresh tokens for clients that are authenticated using client secrets. The access token can be used to fetch short-lived credentials for the assigned AWS accounts or to access application APIs using "bearer" authentication. See also: AWS API Documentation **Request Syntax** response = client.create_token( clientId='string', clientSecret='string', grantType='string', deviceCode='string', code='string', refreshToken='string', scope=[ 'string', ], redirectUri='string', codeVerifier='string' ) Parameters: * **clientId** (*string*) -- **[REQUIRED]** The unique identifier string for the client or application. This value comes from the result of the RegisterClient API. * **clientSecret** (*string*) -- **[REQUIRED]** A secret string generated for the client. This value should come from the persisted result of the RegisterClient API. * **grantType** (*string*) -- **[REQUIRED]** Supports the following OAuth grant types: Authorization Code, Device Code, and Refresh Token. Specify one of the following values, depending on the grant type that you want: * Authorization Code - "authorization_code" * Device Code - "urn:ietf:params:oauth:grant-type:device_code" * Refresh Token - "refresh_token" * **deviceCode** (*string*) -- Used only when calling this API for the Device Code grant type. This short-lived code is used to identify this authorization request. This comes from the result of the StartDeviceAuthorization API. * **code** (*string*) -- Used only when calling this API for the Authorization Code grant type. The short-lived code is used to identify this authorization request. * **refreshToken** (*string*) -- Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see *Considerations for Using this Guide* in the IAM Identity Center OIDC API Reference. * **scope** (*list*) -- The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes that are granted. If this value is not specified, IAM Identity Center authorizes all scopes that are configured for the client during the call to RegisterClient. * *(string) --* * **redirectUri** (*string*) -- Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code. * **codeVerifier** (*string*) -- Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time. Return type: dict Returns: **Response Syntax** { 'accessToken': 'string', 'tokenType': 'string', 'expiresIn': 123, 'refreshToken': 'string', 'idToken': 'string' } **Response Structure** * *(dict) --* * **accessToken** *(string) --* A bearer token to access Amazon Web Services accounts and applications assigned to a user. * **tokenType** *(string) --* Used to notify the client that the returned token is an access token. The supported token type is "Bearer". * **expiresIn** *(integer) --* Indicates the time in seconds when an access token will expire. * **refreshToken** *(string) --* A token that, if present, can be used to refresh a previously issued access token that might have expired. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see *Considerations for Using this Guide* in the IAM Identity Center OIDC API Reference. * **idToken** *(string) --* The "idToken" is not implemented or supported. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see *Considerations for Using this Guide* in the IAM Identity Center OIDC API Reference. A JSON Web Token (JWT) that identifies who is associated with the issued access token. **Exceptions** * "SSOOIDC.Client.exceptions.InvalidRequestException" * "SSOOIDC.Client.exceptions.InvalidClientException" * "SSOOIDC.Client.exceptions.InvalidGrantException" * "SSOOIDC.Client.exceptions.UnauthorizedClientException" * "SSOOIDC.Client.exceptions.UnsupportedGrantTypeException" * "SSOOIDC.Client.exceptions.InvalidScopeException" * "SSOOIDC.Client.exceptions.AuthorizationPendingException" * "SSOOIDC.Client.exceptions.SlowDownException" * "SSOOIDC.Client.exceptions.AccessDeniedException" * "SSOOIDC.Client.exceptions.ExpiredTokenException" * "SSOOIDC.Client.exceptions.InternalServerException" SSOOIDC / Client / close close ***** SSOOIDC.Client.close() Closes underlying endpoint connections.