This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to create a REST flow with OAuth2 in OO?

I am unsure on how to create a REST flow with OAuth2 in OO, as the HTTP operations don't seem to have the proper input variables that I need for this.

For OAuth2, I e.g. have the following variables:

  • Ressource Owner Name
  • Ressource Owner Password
  • Client Identification
  • Client Secret
  • Access Token URI

In which operation and in which input-variables would I put all those variables in, so that OO can make a proper REST call using OAuth2?

Is there a sample flow for this somewhere in OO?

I have tried to use the sample flow "Get Auth Token" in Library->Integrations->Micro Focus ->Cloud OS, but I couldn't get it to work.

Any help would be greatly appreciated Slight smile

Tags:

Labels:

RPA
  • Suggested Answer

    0  

    Hi,

    Could you try to send a POST REST request to the specified URL with the following body:

    grant_type=client_credentials&client_id=${LV_clientId}&client_secret=${LV_secret}

    I also had to put following in the header, but I am not sure if this is the end point specific:

    cache-control: no-cache, max-age=0
    pragma: no-cache
    accept: application/json

    Leave authType empty.

    As a result you should get a token.

    Good luck

  • 0 in reply to   

    Unfortunately it did not work, but you have still helped me in showing me as to what variables I have to use for this to work:

    By using just the URL, header and body variables in the HTTP-operations, it should indeed be possible to create a REST flow with OAuth2. I'll see if I can get it to work this way Slight smile

  • 0   in reply to 

    Add your credentials in the body to authenticate

    grant_type=password&client_id=${client_id}&client_secret=${client_secret}&username=${admin}&password=${password}

    For me to Snow right Content-Type was application/x-www-form-urlencoded dont know if this is a more general setting.

    Although I am an OpenText employee, I am speaking for myself and not for OpenText.
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • Verified Answer

    +1

    thank you all for your help Slight smile

    It wasn't the complete solution, but you showed me the right direction

    I managed to do it now with the following setup:

    I used the Operation from Base/Library/Operations/HTTP Client/v2.0/Http Client Post

    and then filled out the variables as follows (additional notes are in braces like this sentence):

    url = url for getting the oauth token

    authType = Basic

    username = Client Identification (this username will then be used for the Basic encoding as set by the authType)

    password = Client Secret (this password will then be used for the Basic encoding as set by the authType)

    preemtiveAuth = true (for testing purposes, to ensure the call goes through)

    trustAllRoots = true (again for testing purposes, to ensure the call goes through)

    x509HostnameVerifier = allow_all (again for testing purposes, to ensure the call goes through)

    headers = (nothing, leave this variable empty)

    responseCharacterSet = UTF-8 (this is by default some ISO-8859 and will most likely not work like this, so setting this to UTF-8 is really important!)

    body = grant_type=password&username=${ressource-owner-username}&password=${ressource-owner-password}    (here the "Ressource Owner Name" and the "Ressource Owner Password" are used as a variable within the entry for the body)

    contentType = application/x-www-form-urlencoded

    requestCharacterSet = UTF-8 (again, any other encoding will likely not work)

    method = POST