2026/11/18 - AWS Sign-In Service - 3 new1 updated api methods
Changes These APIs enable customers and administrators to list, view, and revoke AWS Sign-In Sessions programmatically using the AWS CLI and SDKs, providing greater visibility and control over authenticated access.
Revokes up to five sign-in sessions. A revoked session can no longer be refreshed. Revoking a session that is already revoked succeeds. Each session must belong to the identity specified by principalArn, or to the caller if principalArn is omitted. Failures for individual sessions are returned in the errors list and do not fail the whole request.
See also: AWS API Documentation
Request Syntax
client.batch_revoke_sessions(
principalArn='string',
sessionArns=[
'string',
],
reason='string'
)
string
The identity that owns the sessions. Omit to use the caller. Specify arn:aws:iam::{account-id}:* to revoke any session in the account.
list
[REQUIRED]
The ARNs of the sessions to revoke
(string) --
Sign-in session ARN
string
The reason for revoking the sessions
dict
Response Syntax
{
'revokedSessions': [
{
'sessionArn': 'string'
},
],
'errors': [
{
'sessionArn': 'string',
'code': 'string',
'message': 'string'
},
]
}
Response Structure
(dict) --
Output for BatchRevokeSessions operation
revokedSessions (list) --
Sessions that were revoked
(dict) --
A session that was revoked
sessionArn (string) --
The revoked session ARN
errors (list) --
Sessions that could not be revoked
(dict) --
A session that could not be revoked
sessionArn (string) --
The session ARN
code (string) --
The error code
message (string) --
The error message
Lists sign-in sessions for an IAM identity in your account. If you omit principalArn, the operation lists the caller's own sessions. Specify a user or role ARN to list that identity's sessions, or specify arn:aws:iam::{account-id}:* to list all sessions in the account. Filters are combined with a logical AND.
See also: AWS API Documentation
Request Syntax
client.list_sessions(
principalArn='string',
maxResults=123,
nextToken='string',
status='ACTIVE'|'REVOKED',
clientId='string',
issuedAfter=123,
issuedBefore=123
)
string
The identity whose sessions to list. Omit to list the caller's own sessions. Specify arn:aws:iam::{account-id}:* to list all sessions in the account.
integer
Maximum number of results to return
string
Token for pagination
string
Returns only sessions with this status
string
Returns only sessions created by this OAuth client
integer
Returns only sessions created at or after this time, in Unix epoch seconds
integer
Returns only sessions created before this time, in Unix epoch seconds
dict
Response Syntax
{
'items': [
{
'sessionArn': 'string',
'principalArn': 'string',
'role': 'string',
'status': 'ACTIVE'|'REVOKED',
'issuedAt': 123,
'expiresAt': 123,
'clientId': 'string',
'clientType': 'CLI'|'MCP',
'resource': 'string'
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
Output for ListSessions operation
items (list) --
List of session summaries
(dict) --
Summary of a sign-in session
sessionArn (string) --
The session ARN
principalArn (string) --
The IAM identity that owns the session
role (string) --
The IAM role for the session, when the owner is a role
status (string) --
The session status
issuedAt (integer) --
The time the session was created, in Unix epoch seconds
expiresAt (integer) --
The time the session expires, in Unix epoch seconds
clientId (string) --
The OAuth client that created the session
clientType (string) --
The type of OAuth client that created the session
resource (string) --
The resource that the session's tokens are bound to
nextToken (string) --
Token for next page of results
Returns the details of a single sign-in session. The session must belong to the identity specified by principalArn, or to the caller if principalArn is omitted. A session that belongs to a different identity or account is reported as not found.
See also: AWS API Documentation
Request Syntax
client.get_session(
sessionArn='string',
principalArn='string'
)
string
[REQUIRED]
The ARN of the session to retrieve
string
The identity that owns the session. Omit to use the caller. Specify arn:aws:iam::{account-id}:* to retrieve any session in the account.
dict
Response Syntax
{
'sessionArn': 'string',
'principalArn': 'string',
'role': 'string',
'status': 'ACTIVE'|'REVOKED',
'clientId': 'string',
'clientType': 'CLI'|'MCP',
'resource': 'string',
'issuedAt': 123,
'expiresAt': 123,
'lastUsedAt': 123,
'issuedInRegion': 'string',
'originSessionArn': 'string',
'userAgent': 'string'
}
Response Structure
(dict) --
Output for GetSession operation
sessionArn (string) --
The session ARN
principalArn (string) --
The IAM identity that owns the session
role (string) --
The IAM role for the session, when the owner is a role
status (string) --
The session status
clientId (string) --
The OAuth client that created the session
clientType (string) --
The type of OAuth client that created the session
resource (string) --
The resource that the session's tokens are bound to
issuedAt (integer) --
The time the session was created, in Unix epoch seconds
expiresAt (integer) --
The time the session expires, in Unix epoch seconds
lastUsedAt (integer) --
The time the session was last refreshed, in Unix epoch seconds
issuedInRegion (string) --
The AWS Region where the session was created
originSessionArn (string) --
The ARN of the session this session originated from
userAgent (string) --
The user agent captured when the session was created or last refreshed
{'assertion': 'string', 'clientId': 'string'}
Response {'resource': 'string', 'scope': 'string'}
Exchanges a supported token for an OAuth 2.0 access token scoped to a resource, which you can use to access AWS services from applications.
See also: AWS API Documentation
Request Syntax
client.create_o_auth2_token_with_token_exchange(
grantType='string',
subjectToken='string',
subjectTokenType='string',
assertion='string',
clientId='string',
resource='string',
scope='string'
)
string
[REQUIRED]
The OAuth 2.0 grant type. Currently supports "urn:ietf:params:oauth:grant-type:token-exchange" and "urn:ietf:params:oauth:grant-type:jwt-bearer".
string
The subject token that represents the identity of the party on whose behalf the request is made. Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange".
string
The token type of the subject token. Currently only supports "urn:ietf:params:oauth:token-type:jwt". Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange".
string
The JWT authorization grant, as defined in RFC 7523. Required when "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer".
string
The OAuth 2.0 client identifier. If provided with "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer", must match the assertion's "client_id" claim.
string
The OAuth resource for which the access token is requested:
"grant_type=urn:ietf:params:oauth:grant-type:token-exchange": Required. Must be a service principal. Example: "glue.amazonaws.com".
"grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer": Required when the assertion has no "resource" claim, otherwise must match it. Must be a URI. Example: "https://aws-mcp.us-east-1.api.aws/mcp".
string
The IAM managed policy Amazon Resource Names (ARNs) to apply as session policies that further scope down the permissions of the issued access token, provided as a space-delimited list. Example: "arn:aws:iam::444455556666:policy/MyPolicy".
If provided with "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer", must match the assertion's "scope" claim.
dict
Response Syntax
{
'accessToken': 'string',
'issuedTokenType': 'string',
'tokenType': 'string',
'expiresIn': 123,
'resource': 'string',
'scope': 'string'
}
Response Structure
(dict) --
Output structure for CreateOAuth2TokenWithTokenExchange operation.
Contains the access token, token type, and expiration as defined in RFC 6749 §5.1, plus fields specific to the grant type.
accessToken (string) --
The access token containing principal identity, resource scope, and session metadata.
issuedTokenType (string) --
The token type of the issued token. Returned when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange". Value is "urn:ietf:params:oauth:token-type:access_token" as defined in RFC 8693 §2.2.1.
tokenType (string) --
The token type. Currently only supports "Bearer" as defined in RFC 6749.
expiresIn (integer) --
The token lifetime in seconds. Value is the minimum of the provided token's validity and 1 hour (3600 seconds).
resource (string) --
The resource the access token is scoped to. Returned when "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer".
scope (string) --
The IAM managed policy ARNs applied as session policies, as a space-delimited list. Returned when "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer" and the assertion has a scope.