Table of Contents
A low-level client representing AWS SSO OIDC
AWS Single Sign-On (SSO) OpenID Connect (OIDC) is a web service that enables a client (such as AWS CLI or a native application) to register with AWS SSO. The service also enables the client to fetch the user’s access token upon successful authentication and authorization with AWS SSO. This service conforms with the OAuth 2.0 based implementation of the device authorization grant standard (https://tools.ietf.org/html/rfc8628 ).
For general information about AWS SSO, see What is AWS Single Sign-On? in the AWS SSO User Guide .
This API reference guide describes the AWS SSO OIDC operations that you can call programatically and includes detailed information on data types and errors.
Note
AWS provides SDKs that consist of libraries and sample code for various programming languages and platforms such as Java, Ruby, .Net, iOS, and Android. The SDKs provide a convenient way to create programmatic access to AWS SSO and other AWS services. For more information about the AWS SDKs, including how to download and install them, see Tools for Amazon Web Services .
client = session.create_client('sso-oidc')
These are the available methods:
Check if an operation can be paginated.
Creates and returns an access token for the authorized client. The access token issued will be used to fetch short-term credentials for the assigned roles in the AWS account.
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'
)
[REQUIRED]
The unique identifier string for each client. This value should come from the persisted result of the RegisterClient API.
[REQUIRED]
A secret string generated for the client. This value should come from the persisted result of the RegisterClient API.
[REQUIRED]
Supports grant types for authorization code, refresh token, and device code request.
[REQUIRED]
Used only when calling this API for the device code grant type. This short-term code is used to identify this authentication attempt. This should come from an in-memory reference to the result of the StartDeviceAuthorization API.
The list of scopes that is defined by the client. Upon authorization, this list is used to restrict permissions when granting an access token.
dict
Response Syntax
{
'accessToken': 'string',
'tokenType': 'string',
'expiresIn': 123,
'refreshToken': 'string',
'idToken': 'string'
}
Response Structure
(dict) --
accessToken (string) --
An opaque token to access AWS SSO resources assigned to a user.
tokenType (string) --
Used to notify the client that the returned token is an access token. The supported type is BearerToken .
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.
idToken (string) --
The identifier of the user that associated with the access token, if present.
Exceptions
Generate a presigned url given a client, its method, and arguments
The presigned url
Create a paginator for an operation.
Returns an object that can wait for some condition.
Registers a client with AWS SSO. This allows clients to initiate device authorization. The output should be persisted for reuse through many authentication requests.
See also: AWS API Documentation
Request Syntax
response = client.register_client(
clientName='string',
clientType='string',
scopes=[
'string',
]
)
[REQUIRED]
The friendly name of the client.
[REQUIRED]
The type of client. The service supports only public as a client type. Anything other than public will be rejected by the service.
The list of scopes that are defined by the client. Upon authorization, this list is used to restrict permissions when granting an access token.
dict
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) --
The endpoint where the client can request authorization.
tokenEndpoint (string) --
The endpoint where the client can get an access token.
Exceptions
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'
)
[REQUIRED]
The unique identifier string for the client that is registered with AWS SSO. This value should come from the persisted result of the RegisterClient API operation.
[REQUIRED]
A secret string that is generated for the client. This value should come from the persisted result of the RegisterClient API operation.
[REQUIRED]
The URL for the AWS SSO user portal. For more information, see Using the User Portal in the AWS Single Sign-On User Guide .
dict
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
Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.
The available client exceptions are:
You do not have sufficient access to perform this action.
Example
try:
...
except client.exceptions.AccessDeniedException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
You do not have sufficient access to perform this action.
Indicates that a request to authorize a client with an access user session token is pending.
Example
try:
...
except client.exceptions.AuthorizationPendingException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that a request to authorize a client with an access user session token is pending.
Indicates that the token issued by the service is expired and is no longer valid.
Example
try:
...
except client.exceptions.ExpiredTokenException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that the token issued by the service is expired and is no longer valid.
Indicates that an error from the service occurred while trying to process a request.
Example
try:
...
except client.exceptions.InternalServerException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that an error from the service occurred while trying to process a request.
Indicates that the clientId or clientSecret in the request is invalid. For example, this can occur when a client sends an incorrect clientId or an expired clientSecret .
Example
try:
...
except client.exceptions.InvalidClientException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that the clientId or clientSecret in the request is invalid. For example, this can occur when a client sends an incorrect clientId or an expired clientSecret .
Indicates that the client information sent in the request during registration is invalid.
Example
try:
...
except client.exceptions.InvalidClientMetadataException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that the client information sent in the request during registration is invalid.
Indicates that a request contains an invalid grant. This can occur if a client makes a CreateToken request with an invalid grant type.
Example
try:
...
except client.exceptions.InvalidGrantException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that a request contains an invalid grant. This can occur if a client makes a CreateToken request with an invalid grant type.
Indicates that something is wrong with the input to the request. For example, a required parameter might be missing or out of range.
Example
try:
...
except client.exceptions.InvalidRequestException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that something is wrong with the input to the request. For example, a required parameter might be missing or out of range.
Indicates that the scope provided in the request is invalid.
Example
try:
...
except client.exceptions.InvalidScopeException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that the scope provided in the request is invalid.
Indicates that the client is making the request too frequently and is more than the service can handle.
Example
try:
...
except client.exceptions.SlowDownException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that the client is making the request too frequently and is more than the service can handle.
Indicates that the client is not currently authorized to make the request. This can happen when a clientId is not issued for a public client.
Example
try:
...
except client.exceptions.UnauthorizedClientException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that the client is not currently authorized to make the request. This can happen when a clientId is not issued for a public client.
Indicates that the grant type in the request is not supported by the service.
Example
try:
...
except client.exceptions.UnsupportedGrantTypeException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'error': 'string',
'error_description': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
Indicates that the grant type in the request is not supported by the service.
The available paginators are: