Mule Facebook Connector错误:"无法提取OAuth验证程序。"

时间:2017-05-27 16:01:30

标签: facebook mule mule-studio mule-component

我尝试通过Mule构建非常简单的应用程序来连接到Facebook。 我按照这个演示:enter link description here

最终组件将如下所示: enter image description here

问题一旦我运行应用程序并点击了网址:http://localhost:1111/auth 我在浏览器中收到以下消息:

Could not extract OAuth verifier.

此外,我在控制台中收到以下错误:

Root Exception stack trace:
org.mule.security.oauth.exception.AuthorizationCodeNotFoundException
    at org.mule.security.oauth.processor.ExtractAuthorizationCodeMessageProcessor.extractAuthorizationCode(ExtractAuthorizationCodeMessageProcessor.java:56)
    at org.mule.security.oauth.processor.ExtractAuthorizationCodeMessageProcessor.process(ExtractAuthorizationCodeMessageProcessor.java:39)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)

完整的配置XML

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:facebook="http://www.mulesoft.org/schema/mule/facebook" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/facebook http://www.mulesoft.org/schema/mule/facebook/current/mule-facebook.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
    <http:listener-config name="HTTP_Listener_Configuration1111" host="localhost" port="1111" doc:name="HTTP Listener Configuration"/>
    <facebook:config-with-oauth name="Facebook" consumerKey="111974699389920" consumerSecret="7406759445e528542668752d135c422a" doc:name="Facebook">
        <facebook:oauth-callback-config domain="localhost" localPort="1111" remotePort="1111" path="/*"/>
    </facebook:config-with-oauth>
    <flow name="facebookFlow">
        <http:listener config-ref="HTTP_Listener_Configuration1111" path="/auth" doc:name="HTTP"/>
        <facebook:authorize config-ref="Facebook" doc:name="Facebook"/>
        <choice doc:name="Choice">
            <when expression="#[flowVars.OAuthAccessTokenId != null]">
                <logger level="INFO" doc:name="Logger" message="Authorization is done succefully"/>
                <set-payload doc:name="Set Payload" value="Facebook Authorization Successful"/>
                <json:object-to-json-transformer doc:name="Object to JSON"/>
            </when>
            <otherwise>
                <logger level="INFO" doc:name="Logger" message="Authorization Failed"/>
                <set-payload doc:name="Set Payload" value="Facebook Authorization Failed"/>
            </otherwise>
        </choice>
    </flow>
</mule>

这个问题的原因是什么?怎么避免呢?

2 个答案:

答案 0 :(得分:0)

您必须点击http侦听器网址而不是回调网址。

侦听器网址:http://localhost:1111 - 在运行应用程序后使用此功能。 回调网址:http://localhost:1111/auth

请告诉我它是否有帮助!

阿曼。

答案 1 :(得分:0)

为呼叫Google Spreadsheets的Mule流设置OAuth2时,我收到了同样的错误消息。

有时,当您从API复制并粘贴客户端ID和密钥时,会带来额外的前导或尾随空格,从而导致授权失败。

您应该点击您拥有的HTTP侦听器元素的URL作为您的流的消息源。您正在访问的API应在成功授权后重定向到回调URL。这些调整对我有用,希望他们帮忙!