Skip to content

/AWS1/IF_SIS=>CREATEOAUTH2TOKENWITHIAM()

About CreateOAuth2TokenWithIAM

Grants permission to exchange client credentials for an OAuth 2.0 access token scoped to a resource that can be used to access AWS services from applications

Method Signature

METHODS /AWS1/IF_SIS~CREATEOAUTH2TOKENWITHIAM
  IMPORTING
    !IV_GRANTTYPE TYPE /AWS1/SISCLIENTCREDSGRANTTYPE OPTIONAL
    !IV_RESOURCE TYPE /AWS1/SISSTRING OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_siscreo2tokwithiamrsp
  RAISING
    /AWS1/CX_SISACCESSDENIEDEX
    /AWS1/CX_SISINTERNALSERVEREX
    /AWS1/CX_SISTOOMANYREQSERROR
    /AWS1/CX_SISVLDTNEXCEPTION
    /AWS1/CX_SISCLIENTEXC
    /AWS1/CX_SISSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_granttype TYPE /AWS1/SISCLIENTCREDSGRANTTYPE /AWS1/SISCLIENTCREDSGRANTTYPE

OAuth 2.0 grant type. Must be "client_credentials".

iv_resource TYPE /AWS1/SISSTRING /AWS1/SISSTRING

The OAuth resource for which the access token is requested. Example: "aws-mcp.amazonaws.com".

RETURNING

oo_output TYPE REF TO /aws1/cl_siscreo2tokwithiamrsp /AWS1/CL_SISCREO2TOKWITHIAMRSP

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->createoauth2tokenwithiam(
  iv_granttype = |string|
  iv_resource = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_oauthaccesstoken = lo_result->get_accesstoken( ).
  lv_bearertokentype = lo_result->get_tokentype( ).
  lv_tokenexpiresin = lo_result->get_expiresin( ).
ENDIF.