IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

  • 1.  APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Wed March 03, 2021 12:47 PM

    Can any one assist me on below case?
    how can I pass the bearer token authorization in main request? I applied custom extension policy in request processing stage and applied the external endpoint to get the access token. In response section I tried to add the authorization header with bearer token in main request header but i getting the 401(not authorized) https status.


    #API-Management
    #API-Gateway
    #webMethods


  • 2.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Tue March 09, 2021 01:14 AM

    Hi Zeeshan,
    Are you trying to pass the authorization header with bearer token to the native service? You can add the header information as part of request processing in the request processing Custom Extension. Do let me know if it works.

    Regards.


    #API-Management
    #API-Gateway
    #webMethods


  • 3.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header



  • 4.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Wed March 31, 2021 01:56 AM

    Hi @zeeshan.tufail,

    I see you have two different variables in the transformation value in the response processing section. Where is the value for ${AccessToken} coming from? Can you try the below syntax for the Transformation value:

    Bearer ${response[customExtension].payload.jsonPath[$.access_token]}

    where “access_token” is the json attribute within custom extension’s response containing the access token that you would like to use.


    #API-Management
    #webMethods
    #API-Gateway


  • 5.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Wed March 31, 2021 11:10 AM

    Thanks guy. Issue has been resolved a week ago.


    #API-Management
    #webMethods
    #API-Gateway


  • 6.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Wed August 18, 2021 10:44 PM

    What was the resolution @zeeshan.tufail ?
    I am also into the same situation where I am not able to access the custom variable storing access_token.

    Thanks in advance !!


    #webMethods
    #API-Gateway
    #API-Management


  • 7.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Thu August 19, 2021 12:06 AM

    Hi @Shourabh_Kumar,

    In the Response Processing->Transformation step of the Custom Extension, provide the variable name to which you want to assign the access_token value and variable value would be the json attribute from the response of the custom extension containing the access token. The syntax for both would be like below:

    Variable name : ${request.headers.authorization} (This will pass the token value as an authorization header in the subsequent steps of your API)
    Variable Value: Bearer ${response[customExtension].payload.jsonPath[$.access_token]}

    where “access_token” is the json attribute within custom extension’s response containing the access token that you would like to use.


    #API-Gateway
    #API-Management
    #webMethods


  • 8.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Sat August 28, 2021 02:02 PM

    @Prabaa Can you help on how to pass the payload (client id and secret) if the oauth endpoint expects it as application/x-www-form-urlencoded ?


    #webMethods
    #API-Management
    #API-Gateway


  • 9.  RE: APIGW Custom Extension Policy for external endpoint to get access token and pass into main request header

    Posted Sun August 29, 2021 06:58 AM

    Thanks. It is working now after placing the payload as follows

    client_id=value1&client_secret=value2


    #API-Gateway
    #API-Management
    #webMethods