Skip to content

introspect_o_auth2_token_with_iam

introspect_o_auth2_token_with_iam(
    token: IntrospectionToken,
    *,
    config_overrides: Optional[SigninClientConfig] = None,
    token_type_hint: Optional[TokenTypeHint] = None,
) -> IntrospectOAuth2TokenWithIAMResponse

Inspects the metadata and active state of an OAuth 2.0 access token or refresh token. Implements RFC 7662 OAuth 2.0 Token Introspection over a SigV4-authenticated endpoint. Returns the claims associated with a token issued by AWS Sign-In.

Parameters:

  • token (IntrospectionToken) –

    The access token or refresh token issued by AWS Sign-In.

  • token_type_hint (Optional[TokenTypeHint], default: None ) –

    An optional hint about the type of the token submitted for introspection, as defined in RFC 7662 §2.1. The server checks both token types regardless of the hint. Allowed values: "access_token", "refresh_token".

Raises:

Source code in docs_src/capo_signin/_services/signin.py
def introspect_o_auth2_token_with_iam(
    self,
    token: "capo_signin.types.introspection_token.IntrospectionToken",
    *,
    config_overrides: Optional[SigninClientConfig] = None,
    token_type_hint: Optional[
        "capo_signin.types.token_type_hint.TokenTypeHint"
    ] = None,
) -> "capo_signin.types.introspect_o_auth2_token_with_iam_response.IntrospectOAuth2TokenWithIAMResponse":
    """Inspects the metadata and active state of an OAuth 2.0 access token or refresh token. Implements RFC 7662 OAuth 2.0 Token Introspection over a SigV4-authenticated endpoint. Returns the claims associated with a token issued by AWS Sign-In.

    Args:
        token: The access token or refresh token issued by AWS Sign-In.
        token_type_hint: An optional hint about the type of the token submitted for introspection, as defined in RFC 7662 §2.1. The server checks both token types regardless of the hint. Allowed values: "access_token", "refresh_token".

    Raises:
        capo_signin.errors.access_denied_exception.AccessDeniedException: You do not have sufficient access to perform this action.
        capo_signin.errors.internal_server_exception.InternalServerException: The request failed because of an internal server error.
        capo_signin.errors.too_many_requests_error.TooManyRequestsError: The request failed because you exceeded the request rate limit for this operation.
        capo_signin.errors.validation_exception.ValidationException: The request failed because it contains a malformed, missing, or invalid parameter.
        capo_signin.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_signin.types.introspect_o_auth2_token_with_iam_request.IntrospectOAuth2TokenWithIAMRequest]",
    ) -> OperationResponse[
        "capo_signin.types.introspect_o_auth2_token_with_iam_response.IntrospectOAuth2TokenWithIAMResponse"
    ]:
        import capo_signin._operations.signin.introspect_o_auth2_token_with_iam

        output, http_response = (
            capo_signin._operations.signin.introspect_o_auth2_token_with_iam.introspect_o_auth2_token_with_iam(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_signin.types.introspect_o_auth2_token_with_iam_request.IntrospectOAuth2TokenWithIAMRequest",
    ) -> dict[str, Any]:
        import capo_signin.types.introspect_o_auth2_token_with_iam_request

        return capo_signin.types.introspect_o_auth2_token_with_iam_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "IntrospectOAuth2TokenWithIAM", redact_input=_redact_input
        ),
    )
    input_: capo_signin.types.introspect_o_auth2_token_with_iam_request.IntrospectOAuth2TokenWithIAMRequest = {
        "token": token
    }
    if token_type_hint is not None:
        input_["token_type_hint"] = token_type_hint

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output