Skip to content

/AWS1/CL_BDC=>GETRESOURCEOAUTH2TOKEN()

About GetResourceOauth2Token

Reaturns the Oauth2Token of the provided resource

Method Signature

IMPORTING

Required arguments:

iv_workloadidentitytoken TYPE /AWS1/BDCWKLDIDENTITYTOKENTYPE /AWS1/BDCWKLDIDENTITYTOKENTYPE

The identity token of the workload you want to retrive the Oauth2 Token of.

iv_resourcecredprovidername TYPE /AWS1/BDCCREDPROVIDERNAME /AWS1/BDCCREDPROVIDERNAME

Reference to the credential provider

it_scopes TYPE /AWS1/CL_BDCSCOPESLISTTYPE_W=>TT_SCOPESLISTTYPE TT_SCOPESLISTTYPE

The OAuth scopes requested

iv_oauth2flow TYPE /AWS1/BDCOAUTH2FLOWTYPE /AWS1/BDCOAUTH2FLOWTYPE

The type of flow to be performed

Optional arguments:

iv_userid TYPE /AWS1/BDCUSERIDTYPE /AWS1/BDCUSERIDTYPE

The user ID of the user you're retrieving the token on behalf of.

iv_resourceoauth2returnurl TYPE /AWS1/BDCRESOAUTH2RETURLTYPE /AWS1/BDCRESOAUTH2RETURLTYPE

Callback url to redirect after token retrieval completes. Should be one of the provideded urls during WorkloadIdentity creation

iv_forceauthentication TYPE /AWS1/BDCBOOLEAN /AWS1/BDCBOOLEAN

If true, always initiate a new 3LO flow

it_customparameters TYPE /AWS1/CL_BDCCUSTREQPARMSTYPE_W=>TT_CUSTOMREQUESTPARAMETERSTYPE TT_CUSTOMREQUESTPARAMETERSTYPE

Gives the ability to send extra/custom parameters to the resource credentials provider during the authorization process. Standard OAuth2 flow parameters will not be overriden.

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->/aws1/if_bdc~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_forceauthentication = ABAP_TRUE
  iv_oauth2flow = |string|
  iv_resourcecredprovidername = |string|
  iv_resourceoauth2returnurl = |string|
  iv_userid = |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_string = lo_result->get_authorizationurl( ).
  lv_accesstokentype = lo_result->get_accesstoken( ).
ENDIF.