AWS SSO OIDC

2024/05/10 - AWS SSO OIDC - 3 updated api methods

Changes  Updated request parameters for PKCE support.

CreateToken (updated) Link ¶
Changes (request)
{'codeVerifier': 'string'}

Creates and returns access and refresh tokens for clients that are authenticated using client secrets. The access token can be used to fetch short-term credentials for the assigned AWS accounts or to access application APIs using bearer authentication.

See also: AWS API Documentation

Request Syntax

client.create_token(
    clientId='string',
    clientSecret='string',
    grantType='string',
    deviceCode='string',
    code='string',
    refreshToken='string',
    scope=[
        'string',
    ],
    redirectUri='string',
    codeVerifier='string'
)
type clientId

string

param clientId

[REQUIRED]

The unique identifier string for the client or application. This value comes from the result of the RegisterClient API.

type clientSecret

string

param clientSecret

[REQUIRED]

A secret string generated for the client. This value should come from the persisted result of the RegisterClient API.

type grantType

string

param grantType

[REQUIRED]

Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following values, depending on the grant type that you want:

  • Device Code - urn:ietf:params:oauth:grant-type:device_code

  • Refresh Token - refresh_token

For information about how to obtain the device code, see the StartDeviceAuthorization topic.

type deviceCode

string

param deviceCode

Used only when calling this API for the Device Code grant type. This short-term code is used to identify this authorization request. This comes from the result of the StartDeviceAuthorization API.

type code

string

param code

Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify this authorization request. This grant type is currently unsupported for the CreateToken API.

type refreshToken

string

param refreshToken

Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term 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.

type scope

list

param scope

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) --

type redirectUri

string

param redirectUri

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.

type codeVerifier

string

param codeVerifier

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.

rtype

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.

CreateTokenWithIAM (updated) Link ¶
Changes (request)
{'codeVerifier': 'string'}

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-term credentials for the assigned Amazon Web Services accounts or to access application APIs using bearer authentication.

See also: AWS API Documentation

Request Syntax

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'
)
type clientId

string

param clientId

[REQUIRED]

The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.

type grantType

string

param grantType

[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

type code

string

param code

Used only when calling this API for the Authorization Code grant type. This short-term 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.

type refreshToken

string

param refreshToken

Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-term 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.

type assertion

string

param assertion

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.

type scope

list

param scope

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) --

type redirectUri

string

param redirectUri

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.

type subjectToken

string

param subjectToken

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.

type subjectTokenType

string

param subjectTokenType

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

type requestedTokenType

string

param requestedTokenType

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

type codeVerifier

string

param codeVerifier

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.

rtype

dict

returns

Response Syntax

{
    'accessToken': 'string',
    'tokenType': 'string',
    'expiresIn': 123,
    'refreshToken': 'string',
    'idToken': 'string',
    'issuedTokenType': 'string',
    'scope': [
        '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) --

RegisterClient (updated) Link ¶
Changes (request)
{'entitledApplicationArn': 'string',
 'grantTypes': ['string'],
 'issuerUrl': 'string',
 'redirectUris': ['string']}

Registers a client with IAM Identity Center. 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

client.register_client(
    clientName='string',
    clientType='string',
    scopes=[
        'string',
    ],
    redirectUris=[
        'string',
    ],
    grantTypes=[
        'string',
    ],
    issuerUrl='string',
    entitledApplicationArn='string'
)
type clientName

string

param clientName

[REQUIRED]

The friendly name of the client.

type clientType

string

param clientType

[REQUIRED]

The type of client. The service supports only public as a client type. Anything other than public will be rejected by the service.

type scopes

list

param scopes

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) --

type redirectUris

list

param redirectUris

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) --

type grantTypes

list

param grantTypes

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.

  • (string) --

type issuerUrl

string

param issuerUrl

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.

type entitledApplicationArn

string

param entitledApplicationArn

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.

rtype

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.