Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This feature allows users to configure the following OAuth grant types for HTTP endpoints. You can use either Authorization Code grant type (Refresh token grant type), Client Credentials grant type or Password grant type depending on your preferred third-party service.

Table of Contents
maxLevel6
minLevel6

Note

You can use expressions (xpath or json path) to set these properties for. Refer Define Dynamic Expressions below for more details.
If you need to send additional parameters in the OAuth request body you can define them as a list of parameters. Refer Send additional parameters in OAuth request body.

Warning
  1. To use the Authorization Code grant type (Refresh token grant type) or the Client Credentials grant type you need to have WUM update level 1618940493641 or U2 EI 6.6.0.23.
  2. To use the Password grant type you need to have WUM update level 1631543692764 or U2 EI 6.6.0.56.

...

Authorization Code and Refresh token grant type

...

The passwordCredentials element contains the following parameters that are used to configure OAuth for the endpoint. All of the following attributes are required.

Property NameDescription
clientIdThe Client ID provided by the service when you register your application.
clientSecretThe Client Secret provided by the service when you register your application.
usernameUsername of the user.
passwordPassword of the user.
tokenUrlThe token endpoint URL given by the service to obtain the access tokens.
Code Block
<endpoint name="FoodEP" xmlns="http://ws.apache.org/ns/synapse">
    <http method="get" uri-template="http://localhost:9192/service/foodservice">
        <authentication>
            <oauth>
                <passwordCredentials>
                    <clientId>clientId</clientId>
                    <clientSecret>clientSecret</clientSecret>
                    <username>internal-user</username>
                    <password>abc@123</password>
                    <tokenUrl>oauthServerUrl</tokenUrl>
                </passwordCredentials>
            </oauth>
        </authentication>
    </http>
</endpoint>

...