Legacy Dev Forum Posts

 View Only

Sign Up

Configure Web Service Integration with Oauth2

  • 1.  Configure Web Service Integration with Oauth2

    Posted 06-05-2025 18:41

    SergioRota | 2020-04-14 12:21:08 UTC | #1

    Hi Forum,

    I have to create a Web Service Integration with oauth2 authentication, but when I open the configuration I only se Oauth

    Is this option also for Oauth2?

    Thanks Sergio


    Jason_Mathison | 2020-04-08 14:34:34 UTC | #2

    That option is also for Oauth2. The idea is that this is for any authentication system where you call a dedicated authentication route, and then use the results of that in all future API calls.


    SergioRota | 2020-04-09 08:30:46 UTC | #3

    Hi Jason,

    I have create my Integration and I have modified my Auth Action to have the auth:

    {

    "accesstoken": "9552b5db-9df7-42c7-83d1-5de7876cbxxx", "tokentype": "bearer" }

    I have insert this configuration in my action:

    {

    "requestUrlTemplate": "https://xxxxxxxxxxxxxxx/Activities", "requestType": "GET", "headers": { "Cache-Control": "no-cache", "Content-Type": "application/json", "Authorization": "${authResponse.tokentype} ${authResponse.accesstoken}" }, "requestTemplate": "${input.rawRequest}" }

    When I run the action I have this response:

    {

    "message": "No authentication bearer token specified in authorization header.", "code": "authentication.required", "status": 401, "messageParams": {}, "contextId": "08272acc-65f9-4c62-ba92-74602fab8600", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"error\":\"needlogin\",\"errormessage\":\"No valid authentication for user.\"} [08272acc-65f9-4c62-ba92-74602fab8600]", "code": "AUTHENTICATIONREQUIRED", "status": 401, "messageParams": {}, "details": [], "errors": [] } ] }

    If I insert my keys in this method I can get the correct result:

    {

    "requestUrlTemplate": "https://xxxxxxxxxxxxxxx/Activities", "requestType": "GET", "headers": { "Cache-Control": "no-cache", "Content-Type": "application/json", "Authorization": "Bearer ${input.TOKEN}" }, "requestTemplate": "${input.rawRequest}" }

    The input:

    TOKEN: 9552b5db-9df7-42c7-83d1-5de7876cbxxx

    The response is correct

    Can you help me about this?

    Thanks Sergio


    Jason_Mathison | 2020-04-09 10:54:59 UTC | #4

    The one thing that stands out is that when you are using the documented way of doing this you are getting a "token_type" of "bearer" (lowercase b), so your Authorization header is going to end up looking like: bearer 9552b5db-9df7-42c7-83d1-5de7876cbxxx

    however in the example that you show as working you have an uppercase B in Bearer. Therefore, you might give this a try for Authorization: "Authorization": "Bearer {authResponse.access_token}"

    The RFC for this indicates that Bearer should be upper case, so there is a good chance that this will fix it for you. If that does fix it, please ask the API vendor to fix their authentication response to have the "token_type" return a value they will accept on their other routes :)

    If that doesn't work I would suggest opening a case with the 3rd party to see if they can tell more about why your request is failing. --Jason


    Jason_Mathison | 2020-04-13 19:48:47 UTC | #5

    Hey Sergio, did this resolve the issue for you?


    SergioRota | 2020-04-14 09:31:05 UTC | #6

    Hi Jason, Yes, now It works, THANKS!


    system | 2020-05-15 08:33:44 UTC | #7

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 7511