/AWS1/IF_BDC=>GETRESOURCEOAUTH2TOKEN()¶
About GetResourceOauth2Token¶
Returns the OAuth 2.0 token of the provided resource.
Method Signature¶
METHODS /AWS1/IF_BDC~GETRESOURCEOAUTH2TOKEN
  IMPORTING
    !IV_WORKLOADIDENTITYTOKEN TYPE /AWS1/BDCWKLDIDENTITYTOKENTYPE OPTIONAL
    !IV_RESOURCECREDPROVIDERNAME TYPE /AWS1/BDCCREDPROVIDERNAME OPTIONAL
    !IT_SCOPES TYPE /AWS1/CL_BDCSCOPESLISTTYPE_W=>TT_SCOPESLISTTYPE OPTIONAL
    !IV_OAUTH2FLOW TYPE /AWS1/BDCOAUTH2FLOWTYPE OPTIONAL
    !IV_SESSIONURI TYPE /AWS1/BDCREQUESTURI OPTIONAL
    !IV_RESOURCEOAUTH2RETURNURL TYPE /AWS1/BDCRESOAUTH2RETURLTYPE OPTIONAL
    !IV_FORCEAUTHENTICATION TYPE /AWS1/BDCBOOLEAN OPTIONAL
    !IT_CUSTOMPARAMETERS TYPE /AWS1/CL_BDCCUSTREQPARMSTYPE_W=>TT_CUSTOMREQUESTPARAMETERSTYPE OPTIONAL
    !IV_CUSTOMSTATE TYPE /AWS1/BDCSTATE OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bdcgetreso2tokenrsp
  RAISING
    /AWS1/CX_BDCACCESSDENIEDEX
    /AWS1/CX_BDCINTERNALSERVEREX
    /AWS1/CX_BDCRESOURCENOTFOUNDEX
    /AWS1/CX_BDCTHROTTLINGEX
    /AWS1/CX_BDCUNAUTHORIZEDEX
    /AWS1/CX_BDCVALIDATIONEX
    /AWS1/CX_BDCCLIENTEXC
    /AWS1/CX_BDCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_workloadidentitytoken TYPE /AWS1/BDCWKLDIDENTITYTOKENTYPE /AWS1/BDCWKLDIDENTITYTOKENTYPE¶
The identity token of the workload from which you want to retrieve the OAuth2 token.
iv_resourcecredprovidername TYPE /AWS1/BDCCREDPROVIDERNAME /AWS1/BDCCREDPROVIDERNAME¶
The name of the resource's credential provider.
it_scopes TYPE /AWS1/CL_BDCSCOPESLISTTYPE_W=>TT_SCOPESLISTTYPE TT_SCOPESLISTTYPE¶
The OAuth scopes being requested.
iv_oauth2flow TYPE /AWS1/BDCOAUTH2FLOWTYPE /AWS1/BDCOAUTH2FLOWTYPE¶
The type of flow to be performed.
Optional arguments:¶
iv_sessionuri TYPE /AWS1/BDCREQUESTURI /AWS1/BDCREQUESTURI¶
Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.
iv_resourceoauth2returnurl TYPE /AWS1/BDCRESOAUTH2RETURLTYPE /AWS1/BDCRESOAUTH2RETURLTYPE¶
The callback URL to redirect to after the OAuth 2.0 token retrieval is complete. This URL must be one of the provided URLs configured for the workload identity.
iv_forceauthentication TYPE /AWS1/BDCBOOLEAN /AWS1/BDCBOOLEAN¶
Indicates whether to always initiate a new three-legged OAuth (3LO) flow, regardless of any existing session.
it_customparameters TYPE /AWS1/CL_BDCCUSTREQPARMSTYPE_W=>TT_CUSTOMREQUESTPARAMETERSTYPE TT_CUSTOMREQUESTPARAMETERSTYPE¶
A map of custom parameters to include in the authorization request to the resource credential provider. These parameters are in addition to the standard OAuth 2.0 flow parameters, and will not override them.
iv_customstate TYPE /AWS1/BDCSTATE /AWS1/BDCSTATE¶
An opaque string that will be sent back to the callback URL provided in resourceOauth2ReturnUrl. This state should be used to protect the callback URL of your application against CSRF attacks by ensuring the response corresponds to the original request.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_bdcgetreso2tokenrsp /AWS1/CL_BDCGETRESO2TOKENRSP¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC 
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->getresourceoauth2token(
  it_customparameters = VALUE /aws1/cl_bdccustreqparmstype_w=>tt_customrequestparameterstype(
    (
      VALUE /aws1/cl_bdccustreqparmstype_w=>ts_customreqparamstype_maprow(
        value = new /aws1/cl_bdccustreqparmstype_w( |string| )
        key = |string|
      )
    )
  )
  it_scopes = VALUE /aws1/cl_bdcscopeslisttype_w=>tt_scopeslisttype(
    ( new /aws1/cl_bdcscopeslisttype_w( |string| ) )
  )
  iv_customstate = |string|
  iv_forceauthentication = ABAP_TRUE
  iv_oauth2flow = |string|
  iv_resourcecredprovidername = |string|
  iv_resourceoauth2returnurl = |string|
  iv_sessionuri = |string|
  iv_workloadidentitytoken = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_authorizationurltype = lo_result->get_authorizationurl( ).
  lv_accesstokentype = lo_result->get_accesstoken( ).
  lv_requesturi = lo_result->get_sessionuri( ).
  lv_sessionstatus = lo_result->get_sessionstatus( ).
ENDIF.