Maddy
Maddy

Reputation: 11

OAuth2.0 Credentials from Mule Service

I want to pass OAuth2.0 authorization credential from my Mule service flow to integrate it with FitBit API.

When I am trying to consume FitBit API from PostMan, there is a provision of "Get New Access Token" which asks user to pass 1) Auth URL 2) Access Token URL 3) Client ID 4) Client Secret (FYI -all these credentials would be generated by FitBit).

My issue here is, I am not sure how these credentials would be passed from Mule?

Can any one please help me to provide some pointer please?

Upvotes: 0

Views: 919

Answers (2)

Dev
Dev

Reputation: 91

I was also getting the same error while trying to connect with Channeladvisor API.This error comes only when you try to use HTTPS . The solution of this issue is to configure you TLS/SSL setting. Install new certificate for the same.

Thanks, -Dev

Upvotes: 0

catpaws
catpaws

Reputation: 2283

I think your situation is the same as the Github API example in the MuleSoft docs.

Configure the Mule client app for accessing the FitBit API like the example shows for accessing the Github API:

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration" basePath="/github"/>
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="api.github.com" port="443" doc:name="HTTP Request Configuration">
    <oauth2:authorization-code-grant-type clientId="27...df" clientSecret="ae...6" redirectionUrl="http://localhost:8082/callback">
        <oauth2:authorization-request authorizationUrl="https://github.com/login/oauth/authorize" localAuthorizationUrl="http://localhost:8082/login" />
        <oauth2:token-request tokenUrl="https://github.com/login/oauth/access_token">
            <oauth2:token-response accessToken="#[payload.'access_token']" refreshToken="#[payload.'access_token']"/>
        </oauth2:token-request>
    </oauth2:authorization-code-grant-type>
</http:request-config>
<flow name="oauth-grant-codeFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <http:request config-ref="HTTP_Request_Configuration" path="/user" method="GET" doc:name="HTTP">
        <http:request-builder>
            <http:header headerName="Accept" value="application/vnd.github.v3+json"/>
        </http:request-builder>
    </http:request>
    <dw:transform-message doc:name="Transform Message">
        <dw:set-payload><![CDATA[%dw 1.0 %output application/json
            ---
            payload]]>
       </dw:set-payload>
    </dw:transform-message>
</flow>

Upvotes: 0

Related Questions